about summary refs log tree commit diff
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, 11 insertions, 0 deletions
diff --git a/math/s_csqrt.c b/math/s_csqrt.c
index 068534cd09..b86f53322e 100644
--- a/math/s_csqrt.c
+++ b/math/s_csqrt.c
@@ -148,6 +148,17 @@ __csqrt (__complex__ double x)
 	      s = __scalbn (s, scale);
 	    }
 
+	  if (fabs (r) < DBL_MIN)
+	    {
+	      double force_underflow = r * r;
+	      math_force_eval (force_underflow);
+	    }
+	  if (fabs (s) < DBL_MIN)
+	    {
+	      double force_underflow = s * s;
+	      math_force_eval (force_underflow);
+	    }
+
 	  __real__ res = r;
 	  __imag__ res = __copysign (s, __imag__ x);
 	}