Message371948
When performing some basic calculations, the result is wrong.
0.4 + 8/100
Out[43]: 0.48000000000000004
0.3 + 8/100
Out[44]: 0.38
I thought it could be processor related and tried the same operation with R, but the result was correct. So I tried it on some online repls:
https://repl.it/languages/python3
https://www.learnpython.org/en/Basic_Operators
And the bug is there, it seems to exist in 3.7.6 and 3.8.3 (and probably all versions in between
Other examples of the error:
0.3 + 8/100
Out[50]: 0.38
0.4 + 8/100
Out[51]: 0.48000000000000004
0.4 + a
Out[52]: 0.48000000000000004
0.4 + 9/100
Out[53]: 0.49
0.7 + 9/100
Out[54]: 0.7899999999999999
0.7 + 10/100
Out[55]: 0.7999999999999999
0.7 + 10/100
Out[56]: 0.7999999999999999
0.7 + 11/100
Out[57]: 0.8099999999999999
0.7 + 12/100
Out[58]: 0.82
0.8 + 8/100
Out[59]: 0.88
0.8 + 9/100
Out[60]: 0.89
0.6 + 9/100
Out[61]: 0.69
0.7 + 9/100
Out[62]: 0.7899999999999999 |
|
Date |
User |
Action |
Args |
2020-06-20 17:45:23 | Fenn Ehk | set | recipients:
+ Fenn Ehk |
2020-06-20 17:45:23 | Fenn Ehk | set | messageid: <1592675123.96.0.415795942046.issue41057@roundup.psfhosted.org> |
2020-06-20 17:45:23 | Fenn Ehk | link | issue41057 messages |
2020-06-20 17:45:23 | Fenn Ehk | create | |
|