Mathematics assumes that numbers have infinite precision. However, that's not possible with computers that use floating-point arithmetic, so you get round-off that gives you really tiny numbers instead of 0. Example of the WRONG way to do things (in C++):
float f1 = 2.0 - 1.0;
float f2 = 1.0;
if (f1 == f2)
std::cout << "this might not happen";
else
std::cout << "oops...floating point round-off";
(I still haven't figured out how to insert tabs in forum posts
)
and the RIGHT way:
float f1 = 2.0 - 1.0;
float f2 = 1.0;
if (std::fabs (f1 - f2) < std::numeric_limits <float>::epsilion ())
std::cout << "this works";
I hope this helps