Is comparing against 0.0 safe?
Gabriel Dos Reis
Gabriel.Dos-Reis@cmla.ens-cachan.fr
Tue Feb 15 14:54:00 GMT 2000
"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
[...]
| I was wondering if comparing a float or double against 0.0 is okay
| for all platforms and floating point representations.
It depends on what you mean by 'okay' and on your business.
Sometimes comparing a floating-point with 0.0 is perfectly sensical,
sometimes it is not. In any case the outcome is prefectly reproducible.
-- Gaby
More information about the Gcc
mailing list