RESOLVED FIXED 171197
test262: test262/test/built-ins/Number/prototype/toPrecision/nan.js
https://bugs.webkit.org/show_bug.cgi?id=171197
Summary test262: test262/test/built-ins/Number/prototype/toPrecision/nan.js
Joseph Pecoraro
Reported 2017-04-23 10:33:30 PDT
test262/test/built-ins/Number/prototype/toPrecision/nan.js and related Test: NaN.toPrecision(Infinity) Expected: "NaN" Actual: RangeError: toPrecision() argument must be between 1 and 21 Notes: - Order of operations here need to be refined slightly - Chrome and Firefox pass Spec: https://tc39.github.io/ecma262/#sec-number.prototype.toprecision 20.1.3.5 Number.prototype.toPrecision ( precision ) > 1. Let x be ? thisNumberValue(this value). > 2. If precision is undefined, return ! ToString(x). > 3. Let p be ? ToInteger(precision). > 4. If x is NaN, return the String "NaN". > 5. Let s be the empty String. > 6. If x < 0, then > a. Let s be code unit 0x002D (HYPHEN-MINUS). > b. Let x be -x. > 7. If x = +∞, then > a. Return the String that is the concatenation of s and "Infinity". > 8. If p < 1 or p > 21, throw a RangeError exception. However, an implementation is permitted to extend the behaviour of toPrecision for values of p less than 1 or greater than 21. In this case toPrecision would not necessarily throw RangeError for such values. > ... https://tc39.github.io/ecma262/#sec-number.prototype.toexponential 20.1.3.2 Number.prototype.toExponential ( fractionDigits ) > 1. Let x be ? thisNumberValue(this value). > 2. Let f be ? ToInteger(fractionDigits). > 3. Assert: f is 0, when fractionDigits is undefined. > 4. If x is NaN, return the String "NaN". > 5. Let s be the empty String. > 6. If x < 0, then > a. Let s be "-". > b. Let x be -x. > 7. If x = +∞, then > a. Return the concatenation of the Strings s and "Infinity". > 8. If f < 0 or f > 20, throw a RangeError exception. However, an implementation is permitted to extend the behaviour of toExponential for values of f less than 0 or greater than 20. In this case toExponential would not necessarily throw RangeError for such values. > ...
Attachments
[PATCH] Proposed Fix (12.37 KB, patch)
2017-04-23 10:34 PDT, Joseph Pecoraro
saam: review+
[PATCH] For Landing (12.32 KB, patch)
2017-04-23 13:25 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2017-04-23 10:34:38 PDT
Created attachment 307937 [details] [PATCH] Proposed Fix
Saam Barati
Comment 2 2017-04-23 10:55:42 PDT
Comment on attachment 307937 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=307937&action=review r=me > Source/JavaScriptCore/runtime/NumberPrototype.cpp:404 > + RETURN_IF_EXCEPTION(scope, encodedJSValue()); style nit: We've been doing: `RETURN_IF_EXCEPTION(scope, { });` in most places.
Joseph Pecoraro
Comment 3 2017-04-23 13:25:54 PDT
Created attachment 307940 [details] [PATCH] For Landing
WebKit Commit Bot
Comment 4 2017-04-23 14:18:45 PDT
The commit-queue encountered the following flaky tests while processing attachment 307940 [details]: webrtc/datachannel/basic.html bug 171203 (author: youennf@gmail.com) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 5 2017-04-23 14:19:14 PDT
Comment on attachment 307940 [details] [PATCH] For Landing Clearing flags on attachment: 307940 Committed r215679: <http://trac.webkit.org/changeset/215679>
Note You need to log in before you can comment on or make changes to this bug.