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 mark.dickinson
Recipients joshinsel, mark.dickinson
Date 2021-12-21.08:54:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640076844.55.0.733119353282.issue46144@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-12-21 08:54:04mark.dickinsonsetrecipients: + mark.dickinson, joshinsel
2021-12-21 08:54:04mark.dickinsonsetmessageid: <1640076844.55.0.733119353282.issue46144@roundup.psfhosted.org>
2021-12-21 08:54:04mark.dickinsonlinkissue46144 messages
2021-12-21 08:54:04mark.dickinsoncreate