New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
math.log(x, 10) gives different result than math.log10(x) #47974
Comments
I have found out that the result of math.log(x, 10) is slightly more |
I can't really see a compelling reason to make this change---it I guess this solution seems insufficiently general: why 'fix' OTOH, a two-argument log that was guaranteed correctly rounded |
Mark, thanks for the first review comments. Am also disturbed by the |
Uploaded small documentation patch warning the user of math.log(x, 10) |
Mark, is some of the inaccuracy due to double rounding? Could we make |
No, I don't think so; at least, not in the sense of rounding the same
Seems to me that would only work on older x86 hardware, unless we Personally, I don't think it's worth the effort of fixing this: the And in any case there's always log10. As a separate issue, it may be worth exposing C99's log2 function in |
+1 on a log2 function, especially one that has been generalized to work |
About large integers which can not be converted to float (too big!):
What should be the default type for logX(int)? People expects float Note: logX() means math.log(), math.log2() and/or math.log10(). |
Note that log2(int) -> float wouldn't entirely replace e.g. log2(2**100), log2(2**100+1) and log2(2**100-1) would likely all |
About the number of bits: I prefer an the implementation in int/long |
I'm closing this, for reasons already given. For the proposal to add log2, see bpo-3366. |
The docs were patched in r74617 to (re)close bpo-6765. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: