Skip to content

Commit

Permalink
Normative: ToInteger normalizes -0 to +0 (tc39#1827)
Browse files Browse the repository at this point in the history
Fixes tc39#1637.

This only has an observable impact on `Atomics.store`.
  • Loading branch information
ljharb committed Jan 3, 2020
1 parent cb73c69 commit 7b67249
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -4801,8 +4801,8 @@ <h1>ToInteger ( _argument_ )</h1>
<p>The abstract operation ToInteger converts _argument_ to an integral Number value. This abstract operation functions as follows:</p>
<emu-alg>
1. Let _number_ be ? ToNumber(_argument_).
1. If _number_ is *NaN*, return *+0*.
1. If _number_ is *+0*, *-0*, *+&infin;*, or *-&infin;*, return _number_.
1. If _number_ is *NaN*, *+0*, or *-0*, return *+0*.
1. If _number_ is *+&infin;*, or *-&infin;*, return _number_.
1. Return the Number value that is the same sign as _number_ and whose magnitude is floor(abs(_number_)).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -26256,7 +26256,7 @@ <h1>Function.prototype.bind ( _thisArg_, ..._args_ )</h1>
1. If Type(_targetLen_) is not Number, let _L_ be 0.
1. Else,
1. Set _targetLen_ to ! ToInteger(_targetLen_).
1. Let _L_ be the larger of 0 and the result of _targetLen_ minus the number of elements of _args_.
1. Let _L_ be the larger of *+0* and the result of _targetLen_ minus the number of elements of _args_.
1. Else, let _L_ be 0.
1. Perform ! SetFunctionLength(_F_, _L_).
1. Let _targetName_ be ? Get(_Target_, *"name"*).
Expand Down Expand Up @@ -28501,9 +28501,7 @@ <h1>TimeClip ( _time_ )</h1>
<emu-alg>
1. If _time_ is not finite, return *NaN*.
1. If abs(_time_) &gt; 8.64 &times; 10<sup>15</sup>, return *NaN*.
1. Let _clippedTime_ be ! ToInteger(_time_).
1. If _clippedTime_ is *-0*, set _clippedTime_ to *+0*.
1. Return _clippedTime_.
1. Return ! ToInteger(_time_).
</emu-alg>
<emu-note>
<p>The point of step 4 is that an implementation is permitted a choice of internal representations of time values, for example as a 64-bit signed integer or as a 64-bit floating-point value. Depending on the implementation, this internal representation may or may not distinguish *-0* and *+0*.</p>
Expand Down

0 comments on commit 7b67249

Please sign in to comment.