[issue20539] math.factorial may throw OverflowError

Nick Coghlan report at bugs.python.org
Fri Feb 7 11:54:29 CET 2014


New submission from Nick Coghlan:

I believe this is mostly a curiousity (since actually calculating a factorial this big would take an interminable amount of time), but math.factorial can be provoked into throwing OverflowError by a large enough input:

>>> math.factorial(10**19)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long

>>> math.factorial(1e19)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long

----------
messages: 210448
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: math.factorial may throw OverflowError

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


More information about the Python-bugs-list mailing list