Closed Bug 413965 Opened 14 years ago Closed 14 years ago

35.05 - 5 = 30.049999999999997

Categories

(Toolkit Graveyard :: Error Console, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 5856

People

(Reporter: kenfehling, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

When I type "35.05 - 5" into the error console or "javascript: 35.05 - 5" into the address window, the answer is 30.049999999999997

Reproducible: Always

Steps to Reproduce:
1. Evaluate (35.05 - 5) using JavaScript
2.
3.
Actual Results:  
30.049999999999997

Expected Results:  
30.05

I tested this on Firefox 2 and Firefox 3 Beta.
This is a result of how floating point numbers are held according to the ecmascript spec
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: js-ieee-double-hurts
Product: Firefox → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.