Unlike decimal floats, correctly rounding hex floats is easy and cheap, so we
should do it.  Moreover the standard requires it.

With -Wall GCC complains that the following function is missing a return
statement because it has incorrectly folded the comparison to false.

int foo(void) { if (0x1.0000010000000000000000000000000000000001p0f != 1) return
1; }

Remove one of the long line of zeroes and the precision falls within GCC's
limits and it works.

-- 
           Summary: GCC incorrectly rounds hex floats
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: neil at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720

Reply via email to