[issue8986] math.erfc OverflowError

Mark Dickinson report at bugs.python.org
Sun Jun 13 13:02:02 CEST 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

Fixed in r81967 (trunk) and r81968 (py3k).

I had to weaken the tests for erfc:  its accuracy for largish arguments (25.0 or so) is not ideal---I was seeing errors of 100 ulps and more.  However, I think this level of error is acceptable in practice, since for arguments this size the difference between erfc(x) and erfc(next_float_up(x)) is already several hundred ulps.

If anyone wants to look at improving the accuracy for large arguments, it's the calculation of exp(-x*x) that's the source of the error.  The way to fix it, if anyone cared, would be to do the multiplication x*x in double-double precision, giving x*x = y + z for doubles y and z, and then use exp(-y) * exp(-z) in place of exp(-x*x).

Thanks for catching this, Geremy!

----------
resolution:  -> fixed
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8986>
_______________________________________


More information about the Python-bugs-list mailing list