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 rhettinger
Recipients Camion, rhettinger
Date 2021-01-10.23:09:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Internally, the math.log10() function only works on floats.  By way of the __float__() method, the input to the the math.log10() function is asked to convert itself to a float.  Fractions implement __float__() by just dividing the numerator and denominator.  In your example, the result is smaller than the smallest representable positive float (2**-1074), so the result gets rounded down to 0.0.  The log10() function isn't defined for zero:

    >>> f = Fraction(factorial(10000), factorial(20000)+1)
    >>> float(f)
    >>> log10(f)
    Traceback (most recent call last):
    ValueError: math domain error

Short of adding a log10() method to the Fraction class, there isn't a straight forward way to accommodate getting this to work.
Date User Action Args
2021-01-10 23:09:41rhettingersetrecipients: + rhettinger, Camion
2021-01-10 23:09:41rhettingersetmessageid: <>
2021-01-10 23:09:41rhettingerlinkissue42886 messages
2021-01-10 23:09:41rhettingercreate