Closed Bug 409726 Opened 17 years ago Closed 17 years ago

rounding error with javascript (6 * 1.66 = 9.9566666666666666 instead of 9.96)

Categories

(Core :: JavaScript Engine, defect)

1.8 Branch
x86
Linux
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 5856

People

(Reporter: artaxerxes2, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.10) Gecko/20071213 Fedora/2.0.0.10-3.fc8 Firefox/2.0.0.10 pango-text
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.10) Gecko/20071213 Fedora/2.0.0.10-3.fc8 Firefox/2.0.0.10 pango-text

firefox's javascript engine fails to return a simple result from a multiplication between an integer and a float.

Reproducible: Always

Steps to Reproduce:
Create a page with the following code:
<input type="button" onclick="alert(6 * 1.66)" />
It will return 9.95666666666666 instead of 9.96.

Actual Results:  
9.956666666666

Expected Results:  
9.96

If you multiply with 60 or with 600 instead of 6, you get the expected results.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.8 Branch
See bug 5856 comment 1.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.