[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Floating point and precision loss - a bug?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 18 May 2007 13:00:25 -0300
> I have found a disturbing behaviour in the VM regarding floating point
> calculations.
>
> Code:
> n = 1000.2
> print(n - 1000)
> -- result: 0.20000000000005
>
> Is it a bug in the 5.1.2 release?
No, it's not a bug. 1000.2 cannot be represented exactly in floating point.
Please read http://lua-users.org/wiki/FloatingPoint .
--lhf