summaryrefslogtreecommitdiff
path: root/libquadmath/math/log2q.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
committerMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
commitb32f12dece884f1fa0f04c643a77105aff6ce8bc (patch)
treecdab5f10806561fc198f907299b0e55eb5701ef0 /libquadmath/math/log2q.c
parent166bec868d991fdf71f9a66f994e5977fcab4aa2 (diff)
parenta168a775e93ec31ae743ad282d8e60fa1c116891 (diff)
downloadgcc-gcn.tar.gz
Merge branch 'master' into gcngcn
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