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 Marcelo Marotta, mark.dickinson, rhettinger
Date 2019-02-20.18:23:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550687000.0.0.263780613849.issue36055@roundup.psfhosted.org>
In-reply-to
Content
This isn't a bug: floating-point arithmetic is by its nature approximate, and two sequences of operations that would mathematically give the same result need not give the same result with floating-point.

I'd recommend a read of this portion of the tutorial, which goes into some of the issues involved: https://docs.python.org/3/tutorial/floatingpoint.html

Having said that, you'll get slightly better accuracy in general (one can't make specific guarantees, since everything's dependent on the platform's math library) if you use `math.sqrt(x)` instead of `math.pow(x, 0.5)`, and `math.log2(y)` instead of `math.log(y, 2)`.
History
Date User Action Args
2019-02-20 18:23:20mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, Marcelo Marotta
2019-02-20 18:23:20mark.dickinsonsetmessageid: <1550687000.0.0.263780613849.issue36055@roundup.psfhosted.org>
2019-02-20 18:23:19mark.dickinsonlinkissue36055 messages
2019-02-20 18:23:19mark.dickinsoncreate