0
Why computer did not store float accuretly
3 Answers
+ 4
Due to binary system, computer can never calculate faction to 100% accurate.
+ 3
The problem is not only in computers.
Computers use base 2 numbers and we use base 10.
Every base has problematic numbers.
A problematic number in base 10 is one third
(1/3)
We can not write it accurately. 0.333333333 is not accurate.
Base 2 also has problematic numbers.
However, you can use decimal data types for the precision. (note: they function very differently but are more accurate)
0
thanks