[PATCH] Fix long double rounding functions
Steven Munroe
munroesj@us.ibm.com
Thu Mar 2 23:05:00 GMT 2006
With additional testing we found more corner cases where the ldbl-128ibm
implementations of the rounding functions gave incorrect results. For
example:
Test "rint (4503599627370494.5000000000001) == 4503599627370495.0":
ldouble: 18014398509481984
Failure: Test: rint (4503599627370494.5000000000001) == 4503599627370495.0
Result:
is: 4.50359962737049400000e+15
0x1.ffffffffffffc00000000000000p+51
should be: 4.50359962737049500000e+15
0x1.ffffffffffffe00000000000000p+51
difference: 1.00000000000000000000e+00
0x1.000000000000000000000000000p+0
ulp : 18014398509481984.0000
max.ulp : 0.0000
Test "rint (-4503599627370494.5000000000001) == -4503599627370495.0":
ldouble: 18014398509481984
Failure: Test: rint (-4503599627370494.5000000000001) == -4503599627370495.0
Result:
is: -4.50359962737049400000e+15
-0x1.ffffffffffffc00000000000000p+51
should be: -4.50359962737049500000e+15
-0x1.ffffffffffffe00000000000000p+51
difference: 1.00000000000000000000e+00
0x1.000000000000000000000000000p+0
ulp : 18014398509481984.0000
max.ulp : 0.0000
These are cases where the "decimal point" is at or near the split
between the high/low doubles that compose the long double. Working with
Alan Modra we developed more comprehensive tests and improved algorithms
for rintl, roundl, ceill, floorl, truncl.
These improved implementation exposed an performance issue in for
powerpc due to the heavy use of fegetround/fesetround. So we provided
an improved implementation of fesetround and provided for inlining
fegetround/fesetround for the long double rounding functions.
Finally we provided updated tests for libm-test.inc.
The remaining work is to improve llrintl and llroundl which we will
provide soon as a separate patch.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc-ldround-20060301.txt
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20060302/2aecca07/attachment.txt>
More information about the Libc-alpha
mailing list