|
Boost Users : |
From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2006-07-30 15:33:58
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of David Abrahams
> Sent: Saturday, July 29, 2006 5:15 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] g++ warning: comparing floating point with
==
> or!= is unsafe
>
> > the warning is cause by the code:
> >
> > // Avoid underflow.
> > if( f1 == static_cast<FPT>(0) ||
> > f2 > static_cast<FPT>(1) && f1 < f2 *
> > (std::numeric_limits<FPT>::min)() )
> > return static_cast<FPT>(0);
> >
> > Could someone modify the code to allow it to compile without
warnings on
> > g++?
>
> Try replacing
>
> f1 == static_cast<FPT>(0)
>
> with
>
> f1
[Nat] Maybe (! f1) instead?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net