lua-users home
lua-l archive

Re: [ANN] Lua 5.3.0 (rc4) now available

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


> > I don't know about others but writing larger numbers in exponential
> > format like 1e3 is common in my code. For Lua 5.3, those are always
> > floats. This has interesting consequences:
> >
> > for i = 1, 1e3 do
> > print(i) --> always int
> > end
> >
> > for i = 1e3, 1, -1 do
> > print(i) --> always float
> > end
Note that this corresponds to the usual arithmetic rules.
> > This is probably not a big deal since I could use 10^2 instead.
> 
> Oops, no I can't. Exponentiation always converts operands to float
> too. I guess there's not a good shorthand for large integer constants?
1000? :-)
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /