lua-users home
lua-l archive

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


On Fri, Jan 9, 2015 at 5:07 PM, Patrick Donnelly <batrick@batbytes.com> wrote:
> On Tue, Jan 6, 2015 at 7:37 AM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
>> Lua 5.3.0 (rc4) is now available for testing at
>>         http://www.lua.org/work/lua-5.3.0-rc4.tar.gz
>> [...]
>> All feedback welcome. Thanks.
>
> 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
>
> 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?

-- 
Patrick Donnelly