+ 2

In Idle, if I sum 4+1.065 I get 5.0649999999995. Why?

17th Jan 2016, 2:19 AM
Jorge Guimaraes
Jorge Guimaraes - avatar
3 Respostas
+ 3
because float values are not stored in computers as exact values . when you tell your PC to add 1.065 to an integer the PC will add some value very close to 1.065 .. in some cases you may get lucky but mostly you won't
20th Apr 2016, 10:39 AM
Ravi Yadav
Ravi Yadav - avatar
+ 2
yeah,because of the specificity of float.for exampl,if you do 1.1+1.1+1.1 ,the answer will be 3.3000000000x,while not 3.3.
25th Jun 2016, 4:28 AM
Bruce Lee
Bruce Lee - avatar
0
wait what? i still dont get the answer. so i don't get why python cant even calculate numbers right. that seems pretty simple. or, is pythons answer actually right and i need to interpret addition differently? like, python cant just suck at arithmetic
5th Jul 2016, 2:29 AM
Eren Kalliope
Eren Kalliope - avatar