[Webkit-unassigned] [Bug 9697] New: parseInt results may be inaccurate for numbers grater than 2^53

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Sun Jul 2 09:50:43 PDT 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=9697

           Summary: parseInt results may be inaccurate for numbers grater
                    than 2^53
           Product: WebKit
           Version: 420+ (nightly)
          Platform: PC
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: bjoern.graf at gmail.com


The result of parseInt may be inaccurate if the input number exceeds the 52
bits of the doubles mantissa. This slightly modified comment from Mozillas
js_strtointeger explains it pretty well:

"This happens if the addition in number * radix + digit causes the result to be
rounded down to an even least significant mantissa bit when the first dropped
bit is a one. If any of the following digits in the number (which haven't been
added in yet) are nonzero, then the correct action would have been to round up
instead of down. An example occurs when reading the number 0x1000000000000081,
which rounds to 0x1000000000000000 instead of 0x1000000000000100."

The code from js_strtointeger could be adapted to fix parseInt() in
kjs/function.cpp. 

Failing tests:
ecma/GlobalObject/15.1.2.2-2.js
ecma/LexicalConventions/7.7.3-1.js
ecma/TypeConversion/9.3.1-3.js


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list