lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Floating point resolution?

On Nov 20, 2010, at 7:34 AM, Alexey Malyshev <malma@kaluga.net> wrote:

> What's wrong with this code?
> 
> local i = 1
> i = i + 0.2
> i = i + 0.2
> i = i + 0.2
> i = i + 0.2
> i = i + 0.2
> print(i)
> print(tostring( i ~= 2))
> 
> output:
> 
> 2
> true
> 
>