[issue8692] Use divide-and-conquer for faster factorials
Alexander Belopolsky
report at bugs.python.org
Tue May 11 23:18:02 CEST 2010
Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:
I've noticed that your patch changes
>>> math.factorial(2.**63)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long
to
>>> math.factorial(2.**63)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: factorial() not defined for negative values
While the error message is wrong in both cases, I think OverflowError is a better exception in this case and there should not be a difference between math.factorial(2.**63) and math.factorial(2**63) behavior.
----------
nosy: +belopolsky
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8692>
_______________________________________
More information about the Python-bugs-list
mailing list