diff options
Diffstat (limited to 'lib/msun/src')
-rw-r--r-- | lib/msun/src/e_log.c | 10 | ||||
-rw-r--r-- | lib/msun/src/e_logf.c | 10 | ||||
-rw-r--r-- | lib/msun/src/s_expm1.c | 3 | ||||
-rw-r--r-- | lib/msun/src/s_expm1f.c | 3 | ||||
-rw-r--r-- | lib/msun/src/s_log1p.c | 10 | ||||
-rw-r--r-- | lib/msun/src/s_log1pf.c | 10 |
6 files changed, 36 insertions, 10 deletions
diff --git a/lib/msun/src/e_log.c b/lib/msun/src/e_log.c index fd91aa8..204fb48 100644 --- a/lib/msun/src/e_log.c +++ b/lib/msun/src/e_log.c @@ -107,8 +107,14 @@ __ieee754_log(double x) k += (i>>20); f = x-1.0; if((0x000fffff&(2+hx))<3) { /* -2**-20 <= f < 2**-20 */ - if(f==zero) if(k==0) return zero; else {dk=(double)k; - return dk*ln2_hi+dk*ln2_lo;} + if(f==zero) { + if(k==0) { + return zero; + } else { + dk=(double)k; + return dk*ln2_hi+dk*ln2_lo; + } + } R = f*f*(0.5-0.33333333333333333*f); if(k==0) return f-R; else {dk=(double)k; return dk*ln2_hi-((R-dk*ln2_lo)-f);} diff --git a/lib/msun/src/e_logf.c b/lib/msun/src/e_logf.c index 654c1e2..c3be6ed 100644 --- a/lib/msun/src/e_logf.c +++ b/lib/msun/src/e_logf.c @@ -55,8 +55,14 @@ __ieee754_logf(float x) k += (i>>23); f = x-(float)1.0; if((0x007fffff&(0x8000+ix))<0xc000) { /* -2**-9 <= f < 2**-9 */ - if(f==zero) if(k==0) return zero; else {dk=(float)k; - return dk*ln2_hi+dk*ln2_lo;} + if(f==zero) { + if(k==0) { + return zero; + } else { + dk=(float)k; + return dk*ln2_hi+dk*ln2_lo; + } + } R = f*f*((float)0.5-(float)0.33333333333333333*f); if(k==0) return f-R; else {dk=(float)k; return dk*ln2_hi-((R-dk*ln2_lo)-f);} diff --git a/lib/msun/src/s_expm1.c b/lib/msun/src/s_expm1.c index 4da712d..3de7bfb 100644 --- a/lib/msun/src/s_expm1.c +++ b/lib/msun/src/s_expm1.c @@ -190,9 +190,10 @@ expm1(double x) e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; - if(k==1) + if(k==1) { if(x < -0.25) return -2.0*(e-(x+0.5)); else return one+2.0*(x-e); + } if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ y = one-(e-x); if (k == 1024) y = y*2.0*0x1p1023; diff --git a/lib/msun/src/s_expm1f.c b/lib/msun/src/s_expm1f.c index 6c5d3e7..483472c 100644 --- a/lib/msun/src/s_expm1f.c +++ b/lib/msun/src/s_expm1f.c @@ -96,9 +96,10 @@ expm1f(float x) e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5; - if(k==1) + if(k==1) { if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5)); else return one+(float)2.0*(x-e); + } if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ y = one-(e-x); if (k == 128) y = y*2.0F*0x1p127F; diff --git a/lib/msun/src/s_log1p.c b/lib/msun/src/s_log1p.c index 1af5892..b062a8a 100644 --- a/lib/msun/src/s_log1p.c +++ b/lib/msun/src/s_log1p.c @@ -155,8 +155,14 @@ log1p(double x) } hfsq=0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; - else {c += k*ln2_lo; return k*ln2_hi+c;} + if(f==zero) { + if(k==0) { + return zero; + } else { + c += k*ln2_lo; + return k*ln2_hi+c; + } + } R = hfsq*(1.0-0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); diff --git a/lib/msun/src/s_log1pf.c b/lib/msun/src/s_log1pf.c index de5341d..01d3457 100644 --- a/lib/msun/src/s_log1pf.c +++ b/lib/msun/src/s_log1pf.c @@ -94,8 +94,14 @@ log1pf(float x) } hfsq=(float)0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; - else {c += k*ln2_lo; return k*ln2_hi+c;} + if(f==zero) { + if(k==0) { + return zero; + } else { + c += k*ln2_lo; + return k*ln2_hi+c; + } + } R = hfsq*((float)1.0-(float)0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); |