@@ -55,7 +55,8 @@ _Py_acosh(double x)
5555 else if (x >= two_pow_p28 ) { /* x > 2**28 */
5656 if (Py_IS_INFINITY (x )) {
5757 return x + x ;
58- } else {
58+ }
59+ else {
5960 return log (x )+ ln2 ; /* acosh(huge)=log(2x) */
6061 }
6162 }
@@ -173,15 +174,15 @@ _Py_expm1(double x)
173174 */
174175
175176 if (fabs (x ) < 0.7 ) {
176- double u ;
177- u = exp (x );
178- if (u == 1.0 )
179- return x ;
180- else
181- return (u - 1.0 ) * x / log (u );
177+ double u ;
178+ u = exp (x );
179+ if (u == 1.0 )
180+ return x ;
181+ else
182+ return (u - 1.0 ) * x / log (u );
182183 }
183184 else
184- return exp (x ) - 1.0 ;
185+ return exp (x ) - 1.0 ;
185186}
186187
187188/* log1p(x) = log(1+x). The log1p function is designed to avoid the
@@ -213,17 +214,19 @@ _Py_log1p(double x)
213214
214215 double y ;
215216 if (fabs (x ) < DBL_EPSILON /2. ) {
216- return x ;
217- } else if (-0.5 <= x && x <= 1. ) {
218- /* WARNING: it's possible than an overeager compiler
219- will incorrectly optimize the following two lines
220- to the equivalent of "return log(1.+x)". If this
221- happens, then results from log1p will be inaccurate
222- for small x. */
223- y = 1. + x ;
224- return log (y )- ((y - 1. )- x )/y ;
225- } else {
226- /* NaNs and infinities should end up here */
227- return log (1. + x );
217+ return x ;
218+ }
219+ else if (-0.5 <= x && x <= 1. ) {
220+ /* WARNING: it's possible than an overeager compiler
221+ will incorrectly optimize the following two lines
222+ to the equivalent of "return log(1.+x)". If this
223+ happens, then results from log1p will be inaccurate
224+ for small x. */
225+ y = 1. + x ;
226+ return log (y )- ((y - 1. )- x )/y ;
227+ }
228+ else {
229+ /* NaNs and infinities should end up here */
230+ return log (1. + x );
228231 }
229232}
0 commit comments