lua-users home
lua-l archive

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


> On 13 Jan 2016, at 9:27 pm, Coda Highland <chighland@gmail.com> wrote:
> 
> We've been over THAT debate more than once. The basic conclusion is
> "if you want a double, it's easy enough to get one; we're going to do
> the thing that minimizes data loss."

In particular, from http://www.lua.org/manual/5.3/manual.html#8
"The main difference between Lua 5.2 and Lua 5.3 is the introduction of an integer subtype for numbers. Although this change should not affect "normal" computations, some computations (mainly those that involve some kind of overflow) can give different results."

and also in 3.4.3
"The conversion from strings to numbers goes as follows: First, the string is converted to an integer or a float, following its syntax and the rules of the Lua lexer. (The string may have also leading and trailing spaces and a sign.) Then, the resulting number (float or integer) is converted to the type (float or integer) required by the context (e.g., the operation that forced the conversion)."

The key bit there is "following its syntax and the rules of the Lua lexer". Which say something like that if it looks like an integer (and doesn't have a decimal point), it gets parsed as a lua_Integer.

Regards,

Tom