+ 2
Why 0. 2222222222222222+8. = 8. 2222222222222221
why is it not 8.2222222222222222
3 Answers
+ 10
Because computers.
Floating point numbers (the ones with decimal places) are only stored as an approximation inside your computer, so you can store huge and tiny numbers without requiring a lot of memory. As a result any calculation you do with floats will be a bit off. That's the sad truth! If you need more precision, python does have decimals though: https://docs.python.org/3/library/decimal.html#module-decimal
0
think it this way the decimal for the 8 is in front of it so its the large number so that's why your answer was 8.222222
- 4
in which program??? ;)
its obviously 8.2222more