Message336135
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)`. |
|
Date |
User |
Action |
Args |
2019-02-20 18:23:20 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, Marcelo Marotta |
2019-02-20 18:23:20 | mark.dickinson | set | messageid: <1550687000.0.0.263780613849.issue36055@roundup.psfhosted.org> |
2019-02-20 18:23:19 | mark.dickinson | link | issue36055 messages |
2019-02-20 18:23:19 | mark.dickinson | create | |
|