summaryrefslogtreecommitdiffstats
path: root/lib/msun
diff options
context:
space:
mode:
authorkargl <kargl@FreeBSD.org>2013-06-03 18:51:34 +0000
committerkargl <kargl@FreeBSD.org>2013-06-03 18:51:34 +0000
commit033cb503683dfc2793491b9f0d3ae81b49088df7 (patch)
treef20e2e57881a16c6b45a8bc34274331df9d1f514 /lib/msun
parent27cbbb200ea78cdbe12b7ede2fb96588541601b6 (diff)
downloadFreeBSD-src-033cb503683dfc2793491b9f0d3ae81b49088df7.zip
FreeBSD-src-033cb503683dfc2793491b9f0d3ae81b49088df7.tar.gz
ld80/s_expl.c:
* In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.man. * Fix an off-by-one for small arguments |x| < 0x1p-65. ld128/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.manh and u.xbits.manl. * Fix an off-by-one for small arguments |x| < 0x1p-114. Obtained from: bde
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/ld128/s_expl.c10
-rw-r--r--lib/msun/ld80/s_expl.c12
2 files changed, 9 insertions, 13 deletions
diff --git a/lib/msun/ld128/s_expl.c b/lib/msun/ld128/s_expl.c
index 5a9cdd5..092174d 100644
--- a/lib/msun/ld128/s_expl.c
+++ b/lib/msun/ld128/s_expl.c
@@ -234,18 +234,16 @@ expl(long double x)
ix = hx & 0x7fff;
if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */
if (ix == BIAS + LDBL_MAX_EXP) {
- if (hx & 0x8000 && u.xbits.manh == 0 &&
- u.xbits.manl == 0)
- return (0.0L); /* x is -Inf */
+ if (hx & 0x8000) /* x is -Inf or -NaN */
+ return (-1 / x);
return (x + x); /* x is +Inf or NaN */
}
if (x > o_threshold)
return (huge * huge);
if (x < u_threshold)
return (tiny * tiny);
- } else if (ix < BIAS - 115) { /* |x| < 0x1p-115 */
- if (huge + x > 1.0L) /* trigger inexact iff x != 0 */
- return (1.0L + x);
+ } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */
+ return (1 + x); /* 1 with inexact iff x != 0 */
}
/* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */
diff --git a/lib/msun/ld80/s_expl.c b/lib/msun/ld80/s_expl.c
index a86a5c8..26a378b 100644
--- a/lib/msun/ld80/s_expl.c
+++ b/lib/msun/ld80/s_expl.c
@@ -246,18 +246,16 @@ expl(long double x)
ix = hx & 0x7fff;
if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */
if (ix == BIAS + LDBL_MAX_EXP) {
- if (hx & 0x8000 && u.xbits.man == 1ULL << 63)
- return (0.0L); /* x is -Inf */
- return (x + x); /* x is +Inf, NaN or unsupported */
+ if (hx & 0x8000) /* x is -Inf, -NaN or unsupported */
+ return (-1 / x);
+ return (x + x); /* x is +Inf, +NaN or unsupported */
}
if (x > o_threshold)
return (huge * huge);
if (x < u_threshold)
return (tiny * tiny);
- } else if (ix < BIAS - 66) { /* |x| < 0x1p-66 */
- /* includes pseudo-denormals */
- if (huge + x > 1.0L) /* trigger inexact iff x != 0 */
- return (1.0L + x);
+ } else if (ix < BIAS - 65) { /* |x| < 0x1p-65 (includes pseudos) */
+ return (1 + x); /* 1 with inexact iff x != 0 */
}
ENTERI();
OpenPOWER on IntegriCloud