This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Camion
Recipients Camion
Date 2021-01-10.22:44:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610318683.55.0.0487505722004.issue42886@roundup.psfhosted.org>
In-reply-to
Content
Python is able to computer the logarithms of very large integers and fractions (by using log(num)-log(denom)), However the fractions.Fraction class fails to do it and raises a math domain error exception.

>>> import math, fractions
>>> f=fractions.Fraction(math.factorial(10000), math.factorial(20000)+1)
>>> math.log(f.numerator)-math.log(f.denominator)
-95966.69390038431
>>> math.log(f)
Traceback (most recent call last):
  File "<pyshell#30>", line 1, in <module>
    math.log(f)
ValueError: math domain error
>>> math.log10(f.numerator)-math.log10(f.denominator)
-41677.80560743537
>>> math.log10(f)
Traceback (most recent call last):
  File "<pyshell#32>", line 1, in <module>
    math.log10(f)
ValueError: math domain error
History
Date User Action Args
2021-01-10 22:44:43Camionsetrecipients: + Camion
2021-01-10 22:44:43Camionsetmessageid: <1610318683.55.0.0487505722004.issue42886@roundup.psfhosted.org>
2021-01-10 22:44:43Camionlinkissue42886 messages
2021-01-10 22:44:43Camioncreate