summaryrefslogtreecommitdiffstats
path: root/lib/libm/src/e_powf.c
diff options
context:
space:
mode:
authormartynas <martynas@openbsd.org>2008-07-20 13:07:27 +0000
committermartynas <martynas@openbsd.org>2008-07-20 13:07:27 +0000
commit17d217fa2eec87d6eb388749b37dc3d926685a4e (patch)
tree79126e9187668b0095cc5ee9c949bdce77e20217 /lib/libm/src/e_powf.c
parentuse more accurate algorithm for tan. from fdlibm 5.3: (diff)
downloadwireguard-openbsd-17d217fa2eec87d6eb388749b37dc3d926685a4e.tar.xz
wireguard-openbsd-17d217fa2eec87d6eb388749b37dc3d926685a4e.zip
get in the bug fix for pow, from fdlibm 5.3. also adapt it for
powf, the float version of it > 1. e_pow.c incorrect results when > x is very close to -1.0 and y is very large, e.g. > pow(-1.0000000000000002e+00,4.5035996273704970e+15) = 0 > pow(-9.9999999999999978e-01,4.5035996273704970e+15) = 0 > Correct results are close to -e and -1/e. while here merge more changes for pow, fixes sign in oflow/uflow cases ok millert@
Diffstat (limited to 'lib/libm/src/e_powf.c')
-rw-r--r--lib/libm/src/e_powf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libm/src/e_powf.c b/lib/libm/src/e_powf.c
index 0555bf85b0c..ec93660cc3f 100644
--- a/lib/libm/src/e_powf.c
+++ b/lib/libm/src/e_powf.c
@@ -130,7 +130,7 @@ __ieee754_powf(float x, float y)
if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny;
/* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */
- t = x-1; /* t has 20 trailing zeros */
+ t = ax-one; /* t has 20 trailing zeros */
w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25));
u = ivln2_h*t; /* ivln2_h has 16 sig. bits */
v = t*ivln2_l-w*ivln2;