+ 1
Why aren't floats precise
When i typed 0.1 * 3 in the python shell i got something like 0.3000000004 but why did i get that as outcome and not just 0.3?
1 ответ
+ 5
That occurs because floating-point numers are stored as binary numbers , and you can't precisely store 0.1(binary: 0.000110011001100...) in binary , just like you cant store 1/3 (decimal: 0.33333333333.....) precisely in the decimal system