summaryrefslogtreecommitdiff
path: root/math/s_csqrtf.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_csqrtf.c')
-rw-r--r--math/s_csqrtf.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c
index 7f45cc1320..b30af06e08 100644
--- a/math/s_csqrtf.c
+++ b/math/s_csqrtf.c
@@ -1,5 +1,5 @@
/* Complex square root of float 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 @@ __csqrtf (__complex__ float x)
__real__ x = 0.0f;
__imag__ x = __scalbnf (__imag__ x, -2 * scale);
}
- else if (fabsf (__real__ x) < FLT_MIN
- && fabsf (__imag__ x) < FLT_MIN)
+ else if (fabsf (__real__ x) < 2.0f * FLT_MIN
+ && fabsf (__imag__ x) < 2.0f * FLT_MIN)
{
- scale = -(FLT_MANT_DIG / 2);
+ scale = -((FLT_MANT_DIG + 1) / 2);
__real__ x = __scalbnf (__real__ x, -2 * scale);
__imag__ x = __scalbnf (__imag__ x, -2 * scale);
}
@@ -148,6 +148,9 @@ __csqrtf (__complex__ float x)
s = __scalbnf (s, scale);
}
+ math_check_force_underflow (r);
+ math_check_force_underflow (s);
+
__real__ res = r;
__imag__ res = __copysignf (s, __imag__ x);
}