This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is comparing against 0.0 safe?
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Is comparing against 0.0 safe?
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr>
- Date: 15 Feb 2000 23:54:49 +0100
- Cc: egcs at egcs dot cygnus dot com
- Organization: CMLA, ENS Cachan -- CNRS UMR 8536 (France)
- References: <200002152113.QAA18757@caip.rutgers.edu>
"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