aboutsummaryrefslogtreecommitdiff
path: root/lib/msun
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2002-06-17 15:28:59 +0000
committerBruce Evans <bde@FreeBSD.org>2002-06-17 15:28:59 +0000
commit3e2ec6ea886d3704fed746305b05bda766fe7f8a (patch)
tree1fc315e9d825331ac4e0122b0f2e257a36001a1a /lib/msun
parent93b99d6264fdb4305cae158b56bf916bec73181c (diff)
downloadsrc-3e2ec6ea886d3704fed746305b05bda766fe7f8a.tar.gz
src-3e2ec6ea886d3704fed746305b05bda766fe7f8a.zip
e_pow.c:
Fixed pow(x, y) when x is very close to -1.0 and y is a very large odd integer. E.g., pow(-1.0 - pow(2.0, -52.0), 1.0 + pow(2.0, 52.0)) was 0.0 instead of being very close to -exp(1.0). PR: 39236 Submitted by: Stephen L Moshier <steve@moshier.net> e_powf.c: Apply the same patch although it is just cosmetic because odd integers large enough to cause the problem are too large to be precisely represented as floats. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=98349
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/src/e_pow.c2
-rw-r--r--lib/msun/src/e_powf.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c
index 206f561984cf..e211ec706587 100644
--- a/lib/msun/src/e_pow.c
+++ b/lib/msun/src/e_pow.c
@@ -190,7 +190,7 @@ __ieee754_pow(double x, double y)
if(ix>0x3ff00000) 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-1; /* t has 20 trailing zeros */
w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
u = ivln2_h*t; /* ivln2_h has 21 sig. bits */
v = t*ivln2_l-w*ivln2;
diff --git a/lib/msun/src/e_powf.c b/lib/msun/src/e_powf.c
index 3301937a0666..0f1497fa17c3 100644
--- a/lib/msun/src/e_powf.c
+++ b/lib/msun/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-1; /* 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;