Closed
Bug 520754
Opened 15 years ago
Closed 15 years ago
Multiplying of two specific factors not very accurate
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: cheaterboy, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 When I multiply 60 with 0.24 (0.24*60), the result is not 14.4, but 14.399999999999999 Reproducible: Always Steps to Reproduce: 1. Type/copy into the address bar the following line: javascript:alert(0.24*60) 2. Hit enter. Actual Results: A message box appeared saying 14.399999999999999 Expected Results: A message box should appear saying 14.4
Comment 1•15 years ago
|
||
That's normal in floating point calculation with binary number : you need to make sure that you define how many digits need to be printed afetr the decimla point. In this case proably 2 (since you've used 0.24). Then you get the same digits. see bug 190303 comment 2
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Comment 2•15 years ago
|
||
Aren't all these bugs (this one and the one it is marked a dup of) dups of bug 5856, the grand-daddy of 'em all? Please re-mark if you agree. /be
Updated•15 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•