lua-users home
lua-l archive

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


Am 16.07.2016 um 21:17 schröbte Soni L.:

On 16/07/16 12:15 PM, Philipp Janda wrote:

Doing the interning and equivalence class thing during construction of
your bigints instead of during table indexing has the added advantage,
that `100 == bigint(100)` works as well, that something like
`table.insert({}, bigint(1), x)` works as well, and that it's probably
also faster.

And then you have bigint(2^62) + bigint(2^62) == bigint(-2^63)

Sure. Can happen with `__key` as well (although better hidden):

    local t = { [ bigint( 2^62 ) ] = true }
    next( t ) + next( t ) == -2^63

Maybe `bigint(n)` is not really supposed to be equivalent to integer `n`.

Philipp