[New-bugs-announce] [issue41057] Division error
Fenn Ehk
report at bugs.python.org
Sat Jun 20 13:45:23 EDT 2020
New submission from Fenn Ehk <fennehk at gmail.com>:
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
----------
components: Interpreter Core
messages: 371948
nosy: Fenn Ehk
priority: normal
severity: normal
status: open
title: Division error
type: behavior
versions: Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41057>
_______________________________________
More information about the New-bugs-announce
mailing list