Bug 104145 - Number.prototype.{toPrecision,toExponential} should accept out-of-range input for NaN/Infinity
Summary: Number.prototype.{toPrecision,toExponential} should accept out-of-range input...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 11:24 PST by André Bargull
Modified: 2017-04-25 08:18 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description André Bargull 2012-12-05 11:24:42 PST
Steps to reproduce:

Test case:
---
js> Number.prototype.toExponential.call(NaN, 555)
typein:63: RangeError: precision 555 out of range
js> Number.prototype.toPrecision.call(NaN, 555)
typein:64: RangeError: precision 555 out of range
---



Expected results:

According to [15.7.4.6  Number.prototype.toExponential (fractionDigits)] step 4 resp. step 6 and according to [15.7.4.7  Number.prototype.toPrecision (precision)] step 4 resp. step 7, toExponential()/toPrecision() return "NaN" (or "Infinity") if the this-argument is `NaN` (or `Infinity`). The actual range check on the input argument happens after (!) handling `NaN`/`Infinity`.
Comment 1 André Bargull 2017-04-25 08:18:58 PDT
Does no longer reproduce at r215724.