+ 1
How it's 'false'
print(0.1+0.2==0.3)
2 Answers
+ 2
Floating point operations
Have a look:
http://0.30000000000000004.com/
+ 1
Well it's much interesting.
Listen, We can only express fractions that denominater have prime factors of the base. Otherwise we get repeating decimals.
Like in base 10, 1/8 1/4 can be expressed cleanly whereas 1/7 1/3 can't
Same in base 2, 1/10(0.1) and 1/5(0.2) are repeating decimals
When we add them they get leftover which get carried up when converted to base 10(decimal).
Thus, 0.1+0.2 != 0.3
They actually Equals 0.30000000000000004
Thank You âșïž