Mark Dickinson <dicki...@gmail.com> 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 math.log(x, 2) when x is a power of two, but there are no guarantees - we're at the mercy of the C math library here. ---------- nosy: +mark.dickinson resolution: -> not a bug _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46144> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com