lua-users home
lua-l archive

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


the answer from luiz is what i was seeking.


On Fri, Jun 13, 2014 at 04:45:58PM +0200, Axel Kittenberger wrote:
> You have to specify what you mean exactly.
> 
> The largest value representation is exactly "infinite" which is a
> particular float/double state. So there you have the largest number!
> You get by local inf = 1/0;
> Then you got the largest value that is not infinite, is what Luiz has
> posted,
> Then you got the largest integer stored in double so that +1 does not
> induce rounding errors, which is 2^53.
> 
> 
> 
> 
> On Fri, Jun 13, 2014 at 2:15 PM, Mayuresh Kathe <mayuresh@kathe.in> wrote:
> 
> > hello,
> >
> > i wrote the following snippet (my first attempt at lua code);
> > -- power generator begin
> > function power(n)
> >   local x = 2
> >   for i = 2, n do
> >     x = x * 2
> >   end
> >   return x
> > end
> >
> > print(power(1024))
> > -- power generator end
> >
> > i ran it with 'lua52 square.lua' which gave me an output of "inf".
> >
> > is there any way to find out the largest number lua can handle?
> >
> > thanks,
> >
> > ~mayuresh
> >
> >
> >