[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unexpected calculation result with Lua53
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 4 May 2015 16:34:27 -0300
> > n=1 for i = 1,80 do n = n * i end print(n) n1=n
> 7.1569457046264e+118
> > n=1 for i = 80,1,-1 do n = n * i end print(n) n2=n
> 7.1569457046264e+118
> > return n2-n1
> 1.7917957937422e+103
>
> Only a few googols of difference....
If you print n2/n1 you'll get 1, at least to the 14 decimals shown by default.
In Lua 5.3 you need to do "n=1.0" before each loop.