diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-06-23 16:01:54 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-06-23 16:01:54 +0000 |
commit | 718d34a309493f8697ff9a8fefcbacbba12a2ccd (patch) | |
tree | 314b1f34149f46e8d8ed2a0cd3eb107fedf9fef1 /math/auto-libm-test-in | |
parent | b59549574efeeecf124de05c9183c120eaaa56f0 (diff) | |
download | glibc-718d34a309493f8697ff9a8fefcbacbba12a2ccd.tar.gz glibc-718d34a309493f8697ff9a8fefcbacbba12a2ccd.tar.xz glibc-718d34a309493f8697ff9a8fefcbacbba12a2ccd.zip |
Fix csqrt spurious underflows (bug 18371).
The csqrt implementations in glibc can cause spurious underflows in some cases as a side-effect of the scaling for large arguments (when underflow is correct for the square root of the argument that was scaled down to avoid overflow, but not for the original argument). This patch arranges to avoid the underflowing intermediate computation (eliminating a multiplication in 0.5 in the problem cases where a subsequent scaling by 2 would follow). Tested for x86_64 and x86 and ulps updated accordingly (only needed for x86). [BZ #18371] * math/s_csqrt.c (__csqrt): Avoid multiplication by 0.5 where intermediate but not final result might underflow. * math/s_csqrtf.c (__csqrtf): Likewise. * math/s_csqrtl.c (__csqrtl): Likewise. * math/auto-libm-test-in: Add more tests of csqrt. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update.
Diffstat (limited to 'math/auto-libm-test-in')
-rw-r--r-- | math/auto-libm-test-in | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index cf7fc359b0..d1502ad107 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -1033,6 +1033,13 @@ csqrt 0x1p-16494 0x1p+16383 csqrt 0x1.0000000000000000000000000001p-16382 0x1.0000000000000000000000000001p-16382 csqrt -0x1.0000000000000000000000000001p-16382 -0x1.0000000000000000000000000001p-16382 +csqrt 0x0.ffp128 0x1.1p-61 +csqrt -0x0.ffp128 0x1.1p-61 +csqrt 0x0.ffp1024 0x1.1p-509 +csqrt -0x0.ffp1024 0x1.1p-509 +csqrt 0x0.ffp16384 0x1.1p-8189 +csqrt -0x0.ffp16384 0x1.1p-8189 + ctan 0 0 ctan 0 -0 ctan -0 0 |