lua-users home
lua-l archive

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

On Thu, Jul 3, 2014 at 3:53 PM, zhujun <> wrote:
> x=0
> total=10000000>
> for i=1 , total do
>   x=x+0.01
> end
> y=0.01*total
> print(x)
> print(y)
> print(x==y)

I don't expect x==y to be true, because of small floating-point
errors. But I would expect them to be "pretty close" (i.e. that
abs(x-y) be small)