On 21/08/07, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 20, 2007 at 05:26:22PM -0400, Andy Dougherty wrote:
> > > I can't think of a clean, portable, efficient way to test that a floating
> > > point variable is zero other than == 0.0;
> >
> > Nor can I.  Thus you either use lots of platform-specific code (determined
> > by Configure.pl) or turn off gcc's -Wfloat-equal warning flag and just
> > write f == 0.0.
> >
> > Personally, I'd just turn off the -Wfloat-equal flag, but I have no
> > objection if someone else wants to do all the work to do it the other way.
>
> FWIW, I'm in favor of turning off the -Wfloat-equal flag and using
> the f == 0.0 test.  Using f == 0.0
>    * immediately obvious to understand
>    * portable
>    * correct
>    * more efficient
>    * less code
>
> Somehow I have difficulty seeing that the benefit
> (potentially catching a few floating point equality comparisons)
> is worth compromising on all of the above.

Being the person who originally added the floating point warning and
asked a while ago about how best to perform floating point
comparisons, I'm now in favour if removing the warning.  Having now
seen the pros and cons it seems we're not getting much benefit from a
large amount of effort.  Is it ok then if I switch the warning off?

Paul

Reply via email to