Steven D'Aprano added the comment:
Further to what Mark said, I'm afraid you are mistaken when you thought that
"the result was correct" on R. R cheats by not printing the full precision of
the number, they just stop printing digits, giving a false impression of
accuracy. You can prove this
Mark Dickinson added the comment:
This isn't a bug in Python; it's a consequence of the
what-you-see-is-not-what-you-get nature of binary floating-point.
The behaviour is explained in the tutorial, here:
https://docs.python.org/3/tutorial/floatingpoint.html
--
nosy: +mark.dickinson
New submission from Fenn Ehk :
When performing some basic calculations, the result is wrong.
0.4 + 8/100
Out[43]: 0.48004
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