[Bug target/52593] New: Builtin sqrt on x86 is not correctly rounded

bugdal at aerifal dot cx gcc-bugzilla@gcc.gnu.org
Thu Mar 15 06:00:00 GMT 2012


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

             Bug #: 52593
           Summary: Builtin sqrt on x86 is not correctly rounded
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bugdal@aerifal.cx


The builtin sqrt() on x86 (i387) should be disabled except with -ffast-math
because it is not correctly rounded. For example, sqrt(0x1.fffffffffffffp-1)
yields 1 instead of 0x1.fffffffffffffp-1. Using -fno-builtin-sqrt will give the
correct value assuming your C library/libm is correctly rounded.

Unfortunately bugs like this seem endemic in gcc. I would really like to see
all dubious builtins and other dubious floating point optimizations disabled
except with -ffast-math until somebody takes the time to rigorously test them
and prove their correctness.



More information about the Gcc-bugs mailing list