[issue46144] math.log() returns improper output

2021-12-21 Thread Mark Dickinson
Mark Dickinson added the comment: Yes, confirmed that this is not a bug, but just one of the many consequences of approximating real numbers by floating-point numbers. You may be interested in math.log2 and/or int.bit_length. math.log2(x) *may* give you more accurate results than

[issue46144] math.log() returns improper output

2021-12-20 Thread Joshua Insel
Joshua Insel added the comment: The same problem occurs with the log function from the C standard library, which Python uses to implement its same-named function. -- stage: -> resolved status: open -> closed ___ Python tracker

[issue46144] math.log() returns improper output

2021-12-20 Thread Joshua Insel
New submission from Joshua Insel : math.log(536870912, 2) should return 29.0, because 2^29 = 536870912. However, it instead returns 29.004. -- messages: 408986 nosy: joshinsel priority: normal severity: normal status: open title: math.log() returns improper output type: