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 serhiy.storchaka
Recipients mark.dickinson, rhettinger, serhiy.storchaka, stutzbach
Date 2017-11-08.19:48:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510170532.78.0.213398074469.issue31980@psf.upfronthosting.co.za>
In-reply-to
Content
There is no two-argument libm `log`. Two-argument log(x, base) is implemented as log(x) / log(base). log(base) adds an error.

>>> import math
>>> math.log(2**31, 2)
31.000000000000004

Since two-argument log() doesn't correspond a C function, I think we are free to use more precise implementation.

We could correct also two-argument logarithms with other bases. For example:

def prec_log(x, y):
    a = math.log(x, y)
    return a + math.log(x / math.pow(y, a), y)

>>> math.log(3**20, 3)
19.999999999999996
>>> prec_log(3**20, 3)
20.0
History
Date User Action Args
2017-11-08 19:48:52serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, mark.dickinson, stutzbach
2017-11-08 19:48:52serhiy.storchakasetmessageid: <1510170532.78.0.213398074469.issue31980@psf.upfronthosting.co.za>
2017-11-08 19:48:52serhiy.storchakalinkissue31980 messages
2017-11-08 19:48:52serhiy.storchakacreate