|
Authored by: Anonymous on Thursday, March 28 2013 @ 08:31 PM EDT |
This is a very common misunderstanding of floating point numbers. They
provide a convenient approximation of real numbers, but are a very peculiar
beast for math.
One way to see this problem is that integers and fixed-point numbers have an
even 'spacing', but floating point numbers are clustered very tightly close to
zero, where the difference between adjacent number is small, but the distance
between adjacent large numbers is huge. This leads to many odd effects, for
example, given two numbers. 'a' and 'b', 'a + b -b -a' might not be zero, if 'b'
is very large, and 'a' is very small (close to zero, not a big but negative
number). Likewise, 'a + b + a - b' typically does not equal '2a'. Integers and
fixed-point numbers do not have these problems.
I'm sure someone else will explain this better shortly ;)
[ Reply to This | Parent | # ]
|
|
|
|
|