Dealing with accuracy problems in floating-point numbers

When you use floating point arithmetic strict equality is almost meaningless. You usually want to compare with a range of acceptable values.

Note that some values can not be represented exactly as floating point vlues.

See What Every Computer Scientist Should Know About Floating-Point Arithmetic and Comparing floating point numbers.

Leave a Comment