-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
In JavaScript Map and Set do not distinguish 0 and -0 as different keys, instead -0 is normalized to 0.
This leads to the following 'bug':
const { Tuple } = require("tuplerone");
if (Math.random() > 0.5) {
Tuple(Object, -0); // sometimes create this first
} else {
Tuple(Object, 0); // other times create this first
}
function isNegativeZero(n) {
return Object.is(n, -0);
}
console.log(isNegativeZero(Tuple(Object, -0)[1])); // sometimes 'true', sometimes 'false'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels