Equality semantics for -0 and NaN · Issue #65 · tc39/proposal-record-tuple (original) (raw)

This repository was archived by the owner on Apr 15, 2025. It is now read-only.

This repository was archived by the owner on Apr 15, 2025. It is now read-only.

@bakkot

Description

@bakkot

What should each of the following evaluate to?

#[+0] == #[-0];

#[+0] === #[-0];

Object.is(#[+0], #[-0]);

#[NaN] == #[NaN];

#[NaN] === #[NaN];

Object.is(#[NaN], #[NaN]);

(For context, this is non-obvious because +0 === -0 is true, Object.is(+0, -0) is false, NaN === NaN is false, and Object.is(NaN, NaN) is true.)

Personally I lean towards the -0 cases all being false and the NaN cases all being true, so that the unusual equality semantics of -0 and NaN do not propagate to the new kinds of objects being introduced by this proposal.