Search code examples
floating-pointfloating-accuracyboolean-expression

0.1 + 0.7 != 0.8


Why in some programming languages the expression in title evaluates to true? I've tried it in php, ruby and python.


Solution

  • Please read What Every Programmer Should Know About Floating-Point Arithmetic .