unsubscribe

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

unsubscribe

Xavier Baquero Dirani
unsusbscribe

On Tue, Apr 21, 2015 at 3:55 PM, Andrew Starks <[hidden email]> wrote:
On Tue, Apr 21, 2015 at 3:46 PM, Coda Highland <[hidden email]> 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