summaryrefslogtreecommitdiff
path: root/math/s_csqrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_csqrt.c')
-rw-r--r--math/s_csqrt.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/math/s_csqrt.c b/math/s_csqrt.c
index 75da2e7449..1f073e7f17 100644
--- a/math/s_csqrt.c
+++ b/math/s_csqrt.c
@@ -1,5 +1,5 @@
/* Complex square root of 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 @@ __csqrt (__complex__ double x)
__real__ x = 0.0;
__imag__ x = __scalbn (__imag__ x, -2 * scale);
}
- else if (fabs (__real__ x) < DBL_MIN
- && fabs (__imag__ x) < DBL_MIN)
+ else if (fabs (__real__ x) < 2.0 * DBL_MIN
+ && fabs (__imag__ x) < 2.0 * DBL_MIN)
{
- scale = -(DBL_MANT_DIG / 2);
+ scale = -((DBL_MANT_DIG + 1) / 2);
__real__ x = __scalbn (__real__ x, -2 * scale);
__imag__ x = __scalbn (__imag__ x, -2 * scale);
}
@@ -148,6 +148,9 @@ __csqrt (__complex__ double x)
s = __scalbn (s, scale);
}
+ math_check_force_underflow (r);
+ math_check_force_underflow (s);
+
__real__ res = r;
__imag__ res = __copysign (s, __imag__ x);
}