math.erfc OverflowError
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Jun 12 23:05:59 EDT 2010
On Sat, 12 Jun 2010 15:49:37 -0700, geremy condra wrote:
> In Python3.2, calling math.erfc with a value in [-27.2, -30) raises an
> OverflowError: math range error. This is inconsistent with the erfc
> function from scipy (scipy.special.erfc) as well as with the C99
> function by the same name, both of which return 2. I suspect that this
> is the result of the cutoff for the use of the continuing fraction
> approximation of erfc beginning when abs(x) > 30, but I'm not sure. Is
> this desired behavior or should I file a bug report?
Geremy, I know that as a general rule, whenever a person finds what seems
to be a bug in Python (or the standard library) they should suspect their
own mistake rather than a bug, but I think this is taking caution to
extremes. The domain of erfc is the set of all real numbers, and the
result is bounded by [0, 2]. So asking if OverflowError is desired
behaviour is a bit like the fellow who bought a new car and then asked if
it's supposed to catch fire when starting the engine...
:)
--
Steven
More information about the Python-list
mailing list