Open innermatrix opened 1 month ago
function negativeZero(val: unknown): val is 0 { return is.number(val) && val === 0 && 1 / val === -Infinity; }
(Type-level typescript doesn't differentiate between +0 and -0; JS runtime does, if you look closely enough.)
Object.is(value, -0) is the easiest way to do. Not sure it's worth adding here as you should almost never have to care about -0 in practice.
Object.is(value, -0)
-0
Didn't think of that! Tyvm.
(Type-level typescript doesn't differentiate between +0 and -0; JS runtime does, if you look closely enough.)