[issue45348] math.log(243, 3) value issue

2021-10-02 Thread Tim Peters
Tim Peters added the comment: CPython's log() builds on the platform C's libm facilities, and C simply doesn't define primitives capable of producing a worst-case < 1 ulp error 2-argument log in reasonable time. Instead we have to build it out of two separate log operations, and a division.

[issue45348] math.log(243, 3) value issue

2021-10-02 Thread Dennis Sweeney
Change by Dennis Sweeney : -- nosy: +mark.dickinson, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue45348] math.log(243, 3) value issue

2021-10-02 Thread Dennis Sweeney
Dennis Sweeney added the comment: It turns out that the current implementation is already very good, within 1ulp in 99.85% of cases and perfect (as good as floats can get) in 65% of cases. So my thinking would be to leave the implementation as is.

[issue45348] math.log(243, 3) value issue

2021-10-02 Thread Dennis Sweeney
Dennis Sweeney added the comment: According to https://docs.python.org/3/library/math.html#math.log : """With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).""" Indeed, this is consistent with that: >>> from math import log >>> log(243) 5.49306144

[issue45348] math.log(243, 3) value issue

2021-10-02 Thread Eddie Caraballo
Eddie Caraballo added the comment: Issue seems to be with all power of 3 divisible by 5 (3**5, 3**10, etc). Powers of 7 also seem to have the issue, where math.log(7**5, 7) = 5.01 -- ___ Python tracker

[issue45348] math.log(243, 3) value issue

2021-10-02 Thread Eddie Caraballo
New submission from Eddie Caraballo : math.log(243, 3) should result in 5.0, but instead results in 4.... Can be worked around via base conversion (math.log10(243) / math.log10(3)) -- components: Library (Lib) messages: 403065 nosy: eddiemichaelc priority: normal severity: normal s