+ 1

Python weird sum

Why does 12.7+18.4 does not equal 31.!? Python prints out 31.099999 instead? Someone?

28th Mar 2018, 4:06 PM
Tomer Sim
Tomer Sim - avatar
2 Réponses
0
Floating point numbers (floats) are not 100% accurate
28th Mar 2018, 4:37 PM
TurtleShell
TurtleShell - avatar
0
This is an example of the floating point issue that we have in modern day programming calculations. See here: https://en.m.wikipedia.org/wiki/Floating-point_arithmetic
28th Mar 2018, 5:27 PM
Dread
Dread - avatar