Re: [Boost-users] g++ warning: comparing floating point with == or!= is unsafe
30 Jul
2006
30 Jul
'06
7:33 p.m.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of David Abrahams Sent: Saturday, July 29, 2006 5:15 PM To: boost-users@lists.boost.org 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?
6678
Age (days ago)
6678
Last active (days ago)
0 comments
1 participants
participants (1)
-
Nat Goodspeed