[Webkit-unassigned] [Bug 14468] New: JS Number.toPrecision(20) and Number.toPrecision(21) are incorrect
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jun 29 15:55:48 PDT 2007
http://bugs.webkit.org/show_bug.cgi?id=14468
Summary: JS Number.toPrecision(20) and Number.toPrecision(21) are
incorrect
Product: WebKit
Version: 522+ (nightly)
Platform: PC
OS/Version: Windows XP
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: JavaScriptCore
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: pamg.bugs at gmail.com
Number(0.0001234567890123456789012345).toPrecision(20) returns
0.00012345678901234565000
Number(0.0001234567890123456789012345).toPrecision(21) also returns
0.000123456789012345650000
Tests failing:
fast/js/kde/Number.html
The problem is that, due to the compiler or FPU or what have you,
1.000000...e+22 * 10.0 is returning 9.999...92e+22 rather than 1.000000...e+23,
so intPow10() in kjs/number_object.cpp is wrong and so is toPrecision().
For reference, IE7 gets the result right, and Firefox 2 gives a different wrong
answer (0.00012345678901234567130).
A couple of other numerical algorithms I tried give the same erroneous result.
Special-casing 1e+22 is just ugly. I'm tempted to add a precision argument to
UString::from(double) and use its string manipulations instead. :/ Any other
suggestions?
--
Configure bugmail: http://bugs.webkit.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