Closed Bug 602912 Opened 14 years ago Closed 6 years ago

MathUtils::parseInt() of large numbers generates values that do not match other js engines

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX
Q1 12 - Brannan

People

(Reporter: brbaker, Unassigned)

References

Details

Attachments

(1 file)

While working on code coverage in MathUtils::parseInt() I noticed some different results between tamarin and other js engines. When parsing large numbers with: parseInt("1234567000123456700", 8) tamarin-redux -> 23528930381028800 all others -> 188231443048230400 (v8, tracemonkey, webkit) Actually looking into this a little more it appears that tamarin is parsing these numbers to match C code: Tamarin: parseInt("1234567000123456700", 8): 23528930381028800 c: strtol("1234567000123456700", 8): 23528930381028800
Flags: in-testsuite?
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Another case where tamarin differs from both a C testcase and other javascript engines: parseInt("1234567890123", 32) tamarin: 38390726480134180 c: 1228503247364293699 others: 1228503247364293600
Are you sure it's the parser and not the printer? My money would be on the latter, though it could be the former. One way to find this out (if you're in the mood) is to Number() the value and then serialize it into a bytearray and dump the bytes, and examine them. (Or look at the bits in a debugger.) I have both string->number and number->strings assigned to me, you can assign this to me too if you want and I can investigate.
Sample code showing the difference of byteArray when writeDouble() is called using 2 numbers that should be equal: Number(1228503247364293699) Number(parseInt("1234567890123", 32)) Note that arr[1] is not equal in the 2 encoded numbers. Number(1228503247364293699) arr[0]: 67 arr[1]: 177 arr[2]: 12 arr[3]: 133 arr[4]: 49 arr[5]: 208 arr[6]: 144 arr[7]: 4 Number(parseInt("1234567890123", 32)) arr[0]: 67 arr[1]: 97 arr[2]: 12 arr[3]: 133 arr[4]: 49 arr[5]: 208 arr[6]: 144 arr[7]: 4
Attachment #484284 - Flags: feedback?(lhansen)
Comment on attachment 484284 [details] parseInt() byteArray encoding sample Looks fine. (Obviously if you start adding cases here you'd want some more procedural abstraction.)
Attachment #484284 - Flags: feedback?(lhansen) → feedback+
Blocks: a2d-d2a
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P3
Target Milestone: --- → Q1 12 - Brannan
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: