Eliminate unnecessary double arithmetics in CUDA