|
On Tue, Apr 21, 2015 at 3:46 PM, Coda Highland <chighland@gmail.com> wrote:
> nkey = (1<<63)-333
> fkey = nkey + 0.0
> print(fkey == nkey) -> true
>
> t = {}
> t[nkey] = "nkey"
> t[fkey] = "fkey"
> print(t[nkey], t[fkey]) -> "fkey" "fkey" -- Expected
> based on equality check above
>
> t[0] = 0
> print(t[nkey], t[fkey]) -> "fkey" nil -- Unexpected
Thank you for your patience. What am I doing wrong here? I only get
expected behavior:
> nkey = (1<<63) - 333
> fkey = nkey + 0.0
> print(fkey == nkey)
true
> t = {[nkey] = 'nkey', [fkey] = 'fkey'}
> print(t[nkey], t[fkey])
nkey fkey
> t[0] = 0
> print(t[nkey], t[fkey])
nkey fkey
> t[nkey] = 'nkey'
> t[fkey] = 'fkey'
> print(t[nkey], t[fkey])
nkey fkey
> t[0] = 0
> print(t[nkey], t[fkey])
nkey fkey
Andrew