+ 1
5*x
Hi. If I print (5*1.07) I always get 5.35000000005. But why? I mean if I do it with 4, the result is 4.28, and with 6 the result is 6.42. same happens if I use 0.07; 1.06; 1.007
3 Answers
+ 7
Hi! Calculating with floats, when coding, is special. Humens work with decimal numbers, computers with binaries. In the conversion between these two number system, there will be losses (round off errors) as we, as coders, need to learn to handle.
+ 5
It's because of how flooting points are handled internally in system..
https://www.geeksforgeeks.org/floating-point-error-in-JUMP_LINK__&&__python__&&__JUMP_LINK/
https://www.sololearn.com/Discuss/1949137/?ref=app
Hope these helps..
+ 2
Thanks.Did not have a clue about this đ