about summary refs log tree commit diff
path: root/src/math/expl.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2013-09-04 07:51:11 +0000
committerSzabolcs Nagy <nsz@port70.net>2013-09-05 11:30:08 +0000
commit39c910fb061114e6aa5c3bf2c94b1d7262d62221 (patch)
tree5ca9b82746e8ac224f93dcda1b8d19f95b68eda2 /src/math/expl.c
parentea9bb95a5b36c0a3d2ed8fb03808745b406c2633 (diff)
downloadmusl-39c910fb061114e6aa5c3bf2c94b1d7262d62221.tar.gz
musl-39c910fb061114e6aa5c3bf2c94b1d7262d62221.tar.xz
musl-39c910fb061114e6aa5c3bf2c94b1d7262d62221.zip
math: fix underflow in exp*.c and long double handling in exp2l
* don't care about inexact flag
* use double_t and float_t (faster, smaller, more precise on x86)
* exp: underflow when result is zero or subnormal and not -inf
* exp2: underflow when result is zero or subnormal and not exact
* expm1: underflow when result is zero or subnormal
* expl: don't underflow on -inf
* exp2: fix incorrect comment
* expm1: simplify special case handling and overflow properly
* expm1: cleanup final scaling and fix negative left shift ub (twopk)
Diffstat (limited to 'src/math/expl.c')
-rw-r--r--src/math/expl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/expl.c b/src/math/expl.c
index 50a04297..b62980fa 100644
--- a/src/math/expl.c
+++ b/src/math/expl.c
@@ -100,7 +100,7 @@ long double expl(long double x)
 	if (x > 11356.5234062941439488L) /* x > ln(2^16384 - 0.5) */
 		return x * 0x1p16383L;
 	if (x < -11399.4985314888605581L) /* x < ln(2^-16446) */
-		return 0x1p-10000L * 0x1p-10000L;
+		return -0x1p-16445L/x;
 
 	/* Express e**x = e**f 2**k
 	 *   = e**(f + k ln(2))