+ 1

Why is this false?

It appears to be an easy question, but why does it return false? https://code.sololearn.com/cIaq1vtJ878j/?ref=app

3rd Sep 2019, 9:39 PM
Beau Tooley
Beau Tooley - avatar
2 ответов
+ 4
https://stackoverflow.com/questions/2100490/floating-point-inaccuracy-examples
3rd Sep 2019, 10:17 PM
HonFu
HonFu - avatar
+ 2
Because floating point numbers aren't very accurate. Even the slightest difference between a, b, and c will return false, so comparing floating point numbers is generally not a good idea for statement or loop conditions.
4th Sep 2019, 3:30 AM
UrBoyO
UrBoyO - avatar