On Tuesday 30 October 2007 17:31, Inga Petuhhov wrote:
> A copy-paste from Python Shell:
> >>> a = 1
> >>> a
>
> 1
>
> >>> a = a + 0.4
> >>> a
>
> 1.3999999999999999
>
> >>> a = a - 0.4
> >>> a
>
> 0.99999999999999989
>
> >>> a == 1
>
> False

Or a bit more simple (and for some maybe even more surprising):

>>> 1.0 == 0.4 - 0.4 + 1.0
True
>>> 1.0 == 1.0 + 0.4 - 0.4
False

Floating points are not "real"s. Even simple commutative laws don't 
hold.


Vinzent.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to