[New-bugs-announce] [issue42886] math.log and math.log10 domain error on very large Fractions
Camion
report at bugs.python.org
Sun Jan 10 17:44:43 EST 2021
New submission from Camion <camion_spam-pybugs at yahoo.com>:
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
----------
components: Library (Lib)
messages: 384783
nosy: Camion
priority: normal
severity: normal
status: open
title: math.log and math.log10 domain error on very large Fractions
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42886>
_______________________________________
More information about the New-bugs-announce
mailing list