[webkit-reviews] review requested: [Bug 9697] parseInt results may be inaccurate for numbers greater than 2^53 : [Attachment 15527] Proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 15 23:01:23 PDT 2007

Cameron Zwarich (cpst) <cwzwarich at uwaterloo.ca> has asked  for review:
Bug 9697: parseInt results may be inaccurate for numbers greater than 2^53

Attachment 15527: Proposed patch

------- Additional Comments from Cameron Zwarich (cpst)
<cwzwarich at uwaterloo.ca>
Here is a patch that fixes these problems, as well as some other problems
related to numeric conversions. It fixes all of the JS Core tests related to
numeric conversion except three in ecma/TypeConversion/9.3.1-3.js. The first
two are actually incorrect tests:

--> - "-0x123456789abcde8" = NaN FAILED! expected: 81985529216486880
--> - "-0x123456789abcde8" = NaN FAILED! expected: 81985529216486880

The ECMA spec (9.3.1) does not allow signs in hexadecimal numbers coerced by
ToNumber(). The last is a specific instance of bug 4885:

--> -"\u20001234\u2001" = NaN FAILED! expected: -1234

It is difficult to make all of the conversion happen in one place, due to
different char sizes and slightly different parsing requirements. Maybe I will
do it at a later time when everything is using wide chars.

More information about the webkit-reviews mailing list