tc39 / proposal-intl-numberformat-v3

Additional features for Intl.NumberFormat to solve key pain points.
MIT License
53 stars 12 forks source link

Fix another _isNegative_ spec bug #129

Closed sffc closed 1 year ago

sffc commented 1 year ago

Fixes #127

anba commented 1 year ago

The change is harmless, but not strictly required, because applying - on any mathematical value still returns a mathematical value, even for zero.

trflynn89 commented 1 year ago

The change is harmless, but not strictly required, because applying - on any mathematical value still returns a mathematical value, even for zero.

The problem is if x was originally -0 when passed to FormatNumericToString, it would be set to 0 in step 1b, then back to -0 in step 4a. This breaks the AOs it is then passed into which assume x is positive, and also makes step 14 (which flips the sign again) set x to positive 0.

anba commented 1 year ago

There's no distinct -0 value for mathematical values, i.e. -0 is exactly equal to +0.