summaryrefslogtreecommitdiff
path: root/libquadmath/math/sqrtq.c
diff options
context:
space:
mode:
Diffstat (limited to 'libquadmath/math/sqrtq.c')
-rw-r--r--libquadmath/math/sqrtq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
index 6ed4605ed5c..f63c0d1f6d2 100644
--- a/libquadmath/math/sqrtq.c
+++ b/libquadmath/math/sqrtq.c
@@ -8,14 +8,17 @@ sqrtq (const __float128 x)
__float128 y;
int exp;
- if (x == 0)
+ if (isnanq (x) || (isinfq (x) && x > 0))
return x;
- if (isnanq (x))
+ if (x == 0)
return x;
if (x < 0)
- return nanq ("");
+ {
+ /* Return NaN with invalid signal. */
+ return (x - x) / (x - x);
+ }
if (x <= DBL_MAX && x >= DBL_MIN)
{