Closed Bug 442293 Opened 16 years ago Closed 15 years ago

Number.toFixed() returns wrong results

Categories

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

x86
Windows XP
defect

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 513039
flash10.1

People

(Reporter: tierney, Assigned: lhansen)

References

Details

Using Adobe Flex Builder Version 2.0.1.167022

Steps to reproduce:

    var x:Number; 
    x = 0.0000000006;
    trace (x);             // gives 6e-10
    trace (x.toFixed(20)); // gives 0.00000000060000000000
    trace (x.toFixed(11)); // gives 0.00000000060
    trace (x.toFixed(10)); // gives 0.0000000006
    trace (x.toFixed(9));  // gives 0.000000001
    trace (x.toFixed(8));  // gives 0.00000001
    trace (x.toFixed(7));  // gives 0.0000001
    trace (x.toFixed(6));  // gives 0.000001
    trace (x.toFixed(5));  // gives 0.00001
    trace (x.toFixed(4));  // gives 0.0001
    trace (x.toFixed(3));  // gives 0.001
    trace (x.toFixed(2));  // gives 0.01
    trace (x.toFixed(1));  // gives 0.1
    trace (x.toFixed(0));  // gives 1. (With an unwanted decimal point)

 Actual Results:

 6e-10
0.00000000060000000000
0.00000000060
0.0000000006
0.000000001
0.00000001
0.0000001
0.000001
0.00001
0.0001
0.001
0.01
0.1
1.

  Expected Results:

 6e-10
0.00000000060000000000
0.00000000060
0.0000000006
0.000000001
0.00000000
0.0000000
0.000000
0.00000
0.0000
0.000
0.00
0.0
0   (Note also: There should NOT be a trailing decimal point)

 
 Workaround (if any): none
 
 
 
Transferred Comments:

Brent Baker - Thu Nov 15 09:02:35 CST 2007
Spidermonkey and ES4RI return the correct resutls (ie: 0.00)
Status: NEW → ASSIGNED
Target Milestone: --- → flash10
Bug transferred from asc db: https://bugs.adobe.com/jira/browse/ASC-3292
set milestone to future, we are deferring past fp10 release.
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Target Milestone: flash10 → Future
Blocks: AS3_Builtins
Status: ASSIGNED → NEW
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P3
Target Milestone: Future → flash10.1
Flags: in-testsuite?
Priority: P3 → P4
Blocks: a2d-d2a
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Removing in-testsuite flag as bug 513039 will address adding a testcase.
Status: RESOLVED → VERIFIED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.