Closed Bug 515380 Opened 15 years ago Closed 15 years ago

TM: parseInt giving inconsistent results with JIT on 1.9.1

Categories

(Core :: JavaScript Engine, defect)

1.9.1 Branch
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 507993

People

(Reporter: hanguofeng, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)

Ok,let’s get to the codes below:

  for(var i=0;i < 1000;i++)
  {
        var result = parseInt(-15.02);
	document.write( result );
	document.write( '' );
  }

What do you think it will output?Rows of -15?It might be in other browsers except Firefox 3.5.2 according to my test.In Firefox 3.5.2,only the begins are -15,others are -16,and the number of -15 is varying at different time,sometime 3 and sometimes maybe 4.

Then,codes following will works:

parseInt(-15.02,10);

Reproducible: Always

Steps to Reproduce:
Ok,let’s get to the codes below:

  for(var i=0;i < 1000;i++)
  {
        var result = parseInt(-15.02);
	document.write( result );
	document.write( '' );
  }

What do you think it will output?Rows of -15?It might be in other browsers except Firefox 3.5.2 according to my test.In Firefox 3.5.2,only the begins are -15,others are -16,and the number of -15 is varying at different time,sometime 3 and sometimes maybe 4.

Then,codes following will works:

parseInt(-15.02,10);
Actual Results:  
-15
-15
-15
-16
-16
....(all -16)

Expected Results:  
-15
-15
...(all -15)
Reproduced with Firefox 3.5.3 and latest Shiretoko on Linux. However, I can't reproduce this with Namoroka or Minefield. Looks like it was fixed somewhere but the fix hasn't been ported over.
Assignee: nobody → general
Severity: normal → major
Status: UNCONFIRMED → NEW
Component: General → JavaScript Engine
Ever confirmed: true
OS: Windows Server 2003 → All
Product: Firefox → Core
QA Contact: general → general
Hardware: x86 → All
Summary: parseInt perform different actions in the same code → TM: parseInt giving inconsistent results with JIT on 1.9.1
Version: unspecified → 1.9.1 Branch
Attached file testcase (deleted) —
This is JIT only, by the way. Disabling javascript.options.jit.content in about:config fixes it.

Dupe of bug 507993?
Thanks for the triaging Dave. #3 is correct, this is a dup.

shell testcase:

for (var i = 0; i < 10; ++i)
    print(parseInt(-15.02));

This is WFM on TM tip. However, bug 507993 wasn't approved to go into 3.5.x. I think this is a bad enough correctness issue that we should take it, so I will request approval.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: