optimization/6258: floor() may return incorrect value when optimized

rth@gcc.gnu.org rth@gcc.gnu.org
Thu Apr 11 14:39:00 GMT 2002


Synopsis: floor() may return incorrect value when optimized

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Thu Apr 11 14:35:14 2002
State-Changed-Why:
    Not a bug.  -ffast-math allows the compiler to replace
    a/90 with a*(1/90).  Except that 1/90 can't be represented
    exactly, so the result of the multiplication is 
    -3.0000000000000001144917494144692682, not -3.  Since the
    value is indeed less than -3, floor rightly returns -4.
    
    If you don't want this to happen, don't use -ffast-math.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6258



More information about the Gcc-bugs mailing list