[issue20539] math.factorial may throw OverflowError

STINNER Victor report at bugs.python.org
Fri Feb 7 18:19:39 CET 2014


STINNER Victor added the comment:

OverflowError makes sense because math.factorial(10**19) will overflow in CPython on common platforms, even if it didn't overflowed yet.

On a supercomputer with a different Python implementation, you may be able to compute it.

IMO An OverflowError is specific to a platform and Python implementation, whereas ValueError is "portable": any Python implementation must raise such error.

I can imagine that a Python implementation may return a pseudo-int type which is supposed to be the result of math.factorial(), so you can compute for example math.factorial(10**19) % 2 (hint: result is 0).

----------

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


More information about the Python-bugs-list mailing list