summaryrefslogtreecommitdiff
path: root/math/s_csqrtl.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_csqrtl.c')
-rw-r--r--math/s_csqrtl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c
index 10988ba6ac..b0b52a565c 100644
--- a/math/s_csqrtl.c
+++ b/math/s_csqrtl.c
@@ -1,5 +1,5 @@
/* Complex square root of long double value.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -104,10 +104,10 @@ __csqrtl (__complex__ long double x)
__real__ x = 0.0L;
__imag__ x = __scalbnl (__imag__ x, -2 * scale);
}
- else if (fabsl (__real__ x) < LDBL_MIN
- && fabsl (__imag__ x) < LDBL_MIN)
+ else if (fabsl (__real__ x) < 2.0L * LDBL_MIN
+ && fabsl (__imag__ x) < 2.0L * LDBL_MIN)
{
- scale = -(LDBL_MANT_DIG / 2);
+ scale = -((LDBL_MANT_DIG + 1) / 2);
__real__ x = __scalbnl (__real__ x, -2 * scale);
__imag__ x = __scalbnl (__imag__ x, -2 * scale);
}
@@ -148,6 +148,9 @@ __csqrtl (__complex__ long double x)
s = __scalbnl (s, scale);
}
+ math_check_force_underflow (r);
+ math_check_force_underflow (s);
+
__real__ res = r;
__imag__ res = __copysignl (s, __imag__ x);
}