summaryrefslogtreecommitdiff
path: root/libquadmath/math/log2q.c
diff options
context:
space:
mode:
Diffstat (limited to 'libquadmath/math/log2q.c')
-rw-r--r--libquadmath/math/log2q.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libquadmath/math/log2q.c b/libquadmath/math/log2q.c
index f8275369b37..865f341f03d 100644
--- a/libquadmath/math/log2q.c
+++ b/libquadmath/math/log2q.c
@@ -181,12 +181,15 @@ log2q (__float128 x)
/* Test for domain */
GET_FLT128_WORDS64 (hx, lx, x);
if (((hx & 0x7fffffffffffffffLL) | lx) == 0)
- return (-1.0Q / (x - x));
+ return (-1.0Q / fabsq (x)); /* log2l(+-0)=-inf */
if (hx < 0)
return (x - x) / (x - x);
if (hx >= 0x7fff000000000000LL)
return (x + x);
+ if (x == 1.0Q)
+ return 0.0Q;
+
/* separate mantissa from exponent */
/* Note, frexp is used so that denormal numbers