18 Jun
2020
18 Jun
'20
2:31 a.m.
When I do a simple float sum the result goes wrong My tests were performed on my pc and sites and ever have the same result https://www.onlinegdb.com/online_python_compiler https://repl.it/languages/python3 Example 1 a = 3.2 print(a) b = 0.1 print(b) c = a + b print(c) Result 3.2 0.1 3.3000000000000003 Example 2 a = 3 b = 4 c = 0.1 while a < b: print(a) a = a + c Result 3 3.1 3.2 3.3000000000000003 3.4000000000000004 3.5000000000000004 3.6000000000000005 3.7000000000000006 3.8000000000000007 3.900000000000001