Closed
Bug 467276
Opened 16 years ago
Closed 16 years ago
NaN/Infinity.toExponential(...) should not check range
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mozilla, Assigned: szegedia)
References
Details
Attachments
(2 files)
according to 15.7.4.6 toExponential should verify the range only after it has verified that the number is neither NaN nor Infinity. that is: Infinity.toExponential(-3) should not throw a RangeError.
Assignee | ||
Comment 1•16 years ago
|
||
Assignee: nobody → szegedia
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•16 years ago
|
||
Reviewing the specification, it seems that in addition to toExponential, toPrecision would also need to allow for both NaN and the two infinities to skip range check, and toPrecision also needs to handle undefined value for precision specially. Attached patch fixes all these problems.
Assignee | ||
Comment 3•16 years ago
|
||
Added testcases
Assignee | ||
Comment 4•16 years ago
|
||
Committed fixes to CVS: *** cvs ci -m "Fix for #467276: NaN/Infinity.toExponential(...) should not check range" -l "/Rhino/src/org/mozilla/javascript/NativeNumber.java" Checking in src/org/mozilla/javascript/NativeNumber.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeNumber.java,v <-- NativeNumber.java new revision: 1.42; previous revision: 1.41 done ok (took 0:01.410) *** *** cvs ci -m "Adding testcases for NaN/Infinity.toExponential(...)/toPrecision() should not check range (see Bug #467276)" -l "/tests/ecma_3/Number/15.7.4.7-1.js" "/tests/ecma_3/Number/15.7.4.6-1.js" Checking in ecma_3/Number/15.7.4.6-1.js; /cvsroot/mozilla/js/tests/ecma_3/Number/15.7.4.6-1.js,v <-- 15.7.4.6-1.js new revision: 1.7; previous revision: 1.6 done Checking in ecma_3/Number/15.7.4.7-1.js; /cvsroot/mozilla/js/tests/ecma_3/Number/15.7.4.7-1.js,v <-- 15.7.4.7-1.js new revision: 1.7; previous revision: 1.6 done ok (took 0:01.629) ***
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 5•16 years ago
|
||
synced to mc: http://hg.mozilla.org/mozilla-central/rev/03d4e7eb5fcb please get a review before checking in js tests or modifications. also, for the time being, please keep in sync with mozilla-central. thanks.
You need to log in
before you can comment on or make changes to this bug.
Description
•