From 718d34a309493f8697ff9a8fefcbacbba12a2ccd Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 23 Jun 2015 16:01:54 +0000 Subject: 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. --- sysdeps/i386/fpu/libm-test-ulps | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sysdeps/i386/fpu') diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 3716a55031..f31974994c 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -1108,6 +1108,8 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "csqrt": +double: 1 +idouble: 1 ildouble: 2 ldouble: 2 -- cgit 1.4.1