[issue1640] Enhancements for mathmodule

Mark Dickinson report at bugs.python.org
Mon Jan 21 16:25:03 CET 2008


Mark Dickinson added the comment:

Okay:  here's an attempted guess at what's happening on Windows:

Near the end of c_atanh, there's a line that reads:

r.real = log1p(4.*z.real/((1-z.real)*(1-z.real) + ay*ay))/4.;

Somehow, when z.real is 0.99999999999999989 and ay is 0, the argument to log1p is ending up one-quarter of the size that it should be.  I 
suspect that the 1-z.real calculation is producing, for reasons that are beyond me, the float 2**-52 instead of the correct value of 2**-
53.

Christian:  if you have any time to play with this, could you try replacing this line with something like:

double temp = 1-z.real
printf("z.real is %.19e\n", z.real);
r.real = log1p(4.*z.real/(temp*temp + ay*ay))/4.;

and see if either the problem goes away or if you can confirm that temp is coming out to be 2.2204460492503131e-16 rather than 1.1102230246251565e-16.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1640>
__________________________________


More information about the Python-bugs-list mailing list