Closed Bug 582086 Opened 14 years ago Closed 14 years ago

javascript calculates incorrectly and outputs 17 digit number

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 5856

People

(Reporter: glasgow, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)

<script type="text/javascript">
var j=0;
j=2.9665983939938605-2.4721084357435252;
document.write(j+" ");
</script>


Reproducible: Always

Steps to Reproduce:
<script type="text/javascript">
var j=0;
j=2.9665983939938605-2.4721084357435252;
document.write(j+" ");
</script>
Actual Results:  
output is 0.49448995825033526 

Expected Results:  
1. a sixteen digit number
2.0.4944899582503353

context: notepad produced html file type with above script only, then browser loaded from file on desktop.
numbers in javascript have a limited precision.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.