eliminate unnecessary double arithmetics in CUDA