[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: About big integers in Lua 5.3.
- From: Sean Conner <sean@...>
- Date: Thu, 14 Jan 2016 14:12:23 -0500
It was thus said that the Great Dirk Laurie once stated:
> 2016-01-14 15:59 GMT+02:00 Roberto Ierusalimschy <email@example.com>:
> >> > On Jan 13, 2016, at 3:11 PM, David Given <firstname.lastname@example.org> wrote:
> >> >
> >> >> On 13/01/16 05:00, Dirk Laurie wrote:
> >> >> [...]
> >> >> Neither. It is in fact correct, provided that you understand
> >> >> twos complement notation.
> >> >
> >> > If the value won't fit in an int64, shouldn't it be parsed as a double?
> >> I don't think that would work since a double can only precisely represent integers up to 2^53.
> > Maybe it could parse as "Inf"?
> What about parsing it as a string? Lossless. Will cause an error
> if compared to a number. Error in arithmetic depends on whether
> Lua was compiled with coercion on or off.
There are a number of ways to handle it (convert to double, current
behavior, return nil, throw an error) and some ways are better in some
contexts than others, so I don't think there's one good way to deal with
-spc (Just my 18446744073709551615 zorkmids)