From 866fa1e8af517728f0ca6964d7a107e1cec48e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 3 Feb 2016 18:39:22 +0100 Subject: [PATCH] Add +0 to Array.prototype.indexOf to convert negative zero to positive zero Fixes https://bugs.ecmascript.org/show_bug.cgi?id=4545 --- spec.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/spec.html b/spec.html index 95472fb2c9..29abcfc711 100644 --- a/spec.html +++ b/spec.html @@ -25275,10 +25275,12 @@

TimeClip (_time_)

1. If _time_ is not finite, return *NaN*. 1. If abs(_time_) > 8.64 × 1015, return *NaN*. - 1. Return ToInteger(_time_) + (*+0*). (Adding a positive zero converts *-0* to *+0*.) + 1. Let _clippedTime_ be ToInteger(_time_). + 1. If _clippedTime_ is -0, let _clippedTime_ be +0. + 1. Return _clippedTime_. -

The point of step 3 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*.

+

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*.

@@ -29372,7 +29374,7 @@

Array.from ( _items_ [ , _mapfn_ [ , _thisArg_ ] ] )

1. Let _defineStatus_ be CreateDataPropertyOrThrow(_A_, _Pk_, _mappedValue_). 1. If _defineStatus_ is an abrupt completion, return ? IteratorClose(_iterator_, _defineStatus_). 1. Increase _k_ by 1. - 1. Note: _items_ is not an Iterable so assume it is an array-like object. + 1. NOTE: _items_ is not an Iterable so assume it is an array-like object. 1. Let _arrayLike_ be ! ToObject(_items_). 1. Let _len_ be ? ToLength(? Get(_arrayLike_, `"length"`)). 1. If IsConstructor(_C_) is *true*, then @@ -29813,7 +29815,7 @@

Array.prototype.indexOf ( _searchElement_ [ , _fromIndex_ ] )

1. Let _n_ be ? ToInteger(_fromIndex_). (If _fromIndex_ is *undefined*, this step produces the value 0.) 1. If _n_ ≥ _len_, return -1. 1. If _n_ ≥ 0, then - 1. Let _k_ be _n_. + 1. If _n_ is -0, let _k_ be +0; else let _k_ be _n_. 1. Else _n_ < 0, 1. Let _k_ be _len_ + _n_. 1. If _k_ < 0, let _k_ be 0. @@ -29883,7 +29885,8 @@

Array.prototype.lastIndexOf ( _searchElement_ [ , _fromIndex_ ] )

1. Let _len_ be ? ToLength(? Get(_O_, `"length"`)). 1. If _len_ is 0, return -1. 1. If argument _fromIndex_ was passed, let _n_ be ? ToInteger(_fromIndex_); else let _n_ be _len_-1. - 1. If _n_ ≥ 0, let _k_ be min(_n_, _len_ - 1). + 1. If _n_ ≥ 0, then + 1. If _n_ is -0, let _k_ be +0; else let _k_ be min(_n_, _len_ - 1). 1. Else _n_ < 0, 1. Let _k_ be _len_ + _n_. 1. Repeat, while _k_ ≥ 0 @@ -30975,7 +30978,7 @@

Runtime Semantics: IterableToArrayLike( _items_ )

1. Let _nextValue_ be ? IteratorValue(_next_). 1. Append _nextValue_ to the end of the List _values_. 1. Return CreateArrayFromList(_values_). - 1. Note: _items_ is not an Iterable so assume it is already an array-like object. + 1. NOTE: _items_ is not an Iterable so assume it is already an array-like object. 1. Return ! ToObject(_items_).