diff --git a/src/lisp/e_log.c b/src/lisp/e_log.c index 4404ce15ed5d94891711eed0bbae5531f314ddc8..032f794a2e1412ed7967a540508825cbee351e87 100644 --- a/src/lisp/e_log.c +++ b/src/lisp/e_log.c @@ -117,8 +117,15 @@ static double zero = 0.0; k += (i>>20); f = x-1.0; if((0x000fffff&(2+hx))<3) { /* |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/src/lisp/s_expm1.c b/src/lisp/s_expm1.c index d6a182766af5cd431f96c0c7cdf1becb20cbf1d0..6e35fd840db6fa5b3e71f48bfe18a728b18f9286 100644 --- a/src/lisp/s_expm1.c +++ b/src/lisp/s_expm1.c @@ -194,9 +194,10 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ 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); utmp.d = y;