Closed Bug 444938 Opened 16 years ago Closed 16 years ago

Javascript: Wrong addition of floats

Categories

(Core :: JavaScript Engine, defect)

1.9.0 Branch
x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 5856

People

(Reporter: tim, Unassigned)

Details

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; de; rv:1.9) Gecko/2008061004 Firefox/3.0 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; de; rv:1.9) Gecko/2008061004 Firefox/3.0 Javascript has problems with some floats. It calculates overprecise, but wrong numbers. 29.99+3 = 32.989999999999995 Reproducible: Always Steps to Reproduce: 1. alert(29.99+3) = 32.989999999999995 2. var a = 29.99 +3; alert(a) = 32.989999999999995 3. alert(29.99+2.99+0.01) = 32.989999999999995 but 1. alert(29.99+2.01+0.99) = 32.99 2. alert(29.99+1) = 30.99 2. alert(29.99+2) = 31.99 Expected Results: 29.99 + 3 = 32.99
Summary: Javascript: Wrong addition of a floats → Javascript: Wrong addition of floats
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.9.0 Branch
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.