```On Thu, 29 Nov 2007 06:03:21 +0900, "Shot (Piotr Szotkowski)" <shot / hot.pl> wrote:
> space.ship.traveller / gmail.com:
>
>> >>> print (-140.14 * 100)
>> -14014.0
>
>> Well, actually this is the correct answer.... i.e. the result we are
>> looking for if we were using real math. But, it is not the correct
>> way to round 14013.999999, which is the actual value that we get with
>> floating point math...
>
> Why isn”Ēt it? I might have learned basic math years ago, but to
> me -14013.999999 rounded to one decimal place is exactly -14014.0
> (it”Ēs also -14014.00 when rounded to two decimal places, as well as
> -14014 when rounded to integers).

This comes up a lot, and I guess the thing that most people have a
hard time wrapping their heads around here is the fact that floating
point numbers don't obey the laws of basic math -- not exactly.

Floating point numbers are an approximation of real numbers.  That's
all.  We're stuck with them because it isn't physically possible to
represent real numbers in hardware, and floating point is one of
the few ways to approximate them efficiently.

And it is a hardware limitation -- you'll see the same behavior in
languages like C or Java which also rely on hardware support for
computations with "decimal" numbers.

-mental

```