Closed Bug 513019 Opened 15 years ago Closed 15 years ago

Number.toFixed(0) incorrect return format

Categories

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

defect

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 513039
flash10.1

People

(Reporter: brbaker, Assigned: lhansen)

References

Details

var p:Number = 0.8123735897243023 trace(p.toFixed(0)) firefox produces: "1" tamarin produces: "1." should not contain the "."
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Transferred from JIRA ASC-3823 http://bugs.adobe.com/jira/browse/ASC-3823 Original description: Steps to reproduce: 1. Run this piece of code inside flash / flex var score:uint = 0; var totalTests:uint = 1000; for(var i:uint=0;i<totalTests;i++){ var p:Number = Math.random() * 10; if(p.toFixed(0).indexOf(".") != -1) score++; } trace ((score * 100) / totalTests); Actual Results: Returns a percentage or bad returns from toFixed around 8 to 11 percent. Expected Results: Number.toFixed(0) should return ints Workaround (if any): Casting it to int sometimes changes the values (toFixed returns a String). So we are doing a validation of the returned value and if it contains a "." dot we strip it out.
Assignee: nobody → rreitmai
Blocks: AS3_Builtins
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P3
Target Milestone: --- → flash10.1
Flags: in-testsuite?
Priority: P3 → P4
Blocks: a2d-d2a
Poaching.
Assignee: rreitmai → lhansen
Status: NEW → ASSIGNED
Priority: P4 → P3
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
Removing in-testsuite flag as this is a dupe - media will be created for bug 513039
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.