I have a number which might be zeros. I divide by that number so I want to test if it's zero to prevent NaN's and infinitys. Is it possible that I still create NaNs / infinity because of rounding errors within the division?
double x; // might be zero
double y;
if(x != 0) return y / x;
EDIT
Thanks for the responses. I'll add some subquestions then.
1) assuming neither x nor y is NaN / +inf or -inf, would a division that results in -inf / +inf result in more CPU cycles or any other unwanted behaviour? (Could it crash?)
2) is there a way to prevent the division from resulting in infinity? Using offsets and so on.