If I want to compare a double-precision number with zero, like x>0.0 or y==0.0, is there anything should be cautious? Since my code contains such comparisons, I wonder that’s ok for CUDA.
Comparisons with zero work exactly like you would expect from the ISO C/C++ standards and IEEE-754 as the relevant governing standards.
Depending on the exact computation performed you may need to account for the possibility that due to round-off in intermediate terms the final result could be .lt. 0, although mathematically it should always be .ge. 0. That is a generic floating-point issue, however, not something particular to CUDA.