This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Is comparing against 0.0 safe?


"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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]