Closed Bug 283303 Opened 20 years ago Closed 20 years ago

wrong sum result in javascript 1999.00 + 439.78, which handles firefox

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 5856

People

(Reporter: lzmywaczyk, Unassigned)

References

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Build Identifier: <html> <head> <script language="javascript"> alert( 1999.00 + 439.78 ); </script> </head> </html> Reproducible: Always
*** Bug 283304 has been marked as a duplicate of this bug. ***
*** Bug 283305 has been marked as a duplicate of this bug. ***
*** Bug 283306 has been marked as a duplicate of this bug. ***
Most FP javscript reports are Dups of Bug 5856 "javascript rounding bug", I don't see enough information to say whether yours is.
The result I get is 2438.7799999999997. Sure sounds like bug 5856.
Assignee: bugs → general
Component: JavaScript Console → JavaScript Engine
Product: Firefox → Core
QA Contact: js-console → pschwartau
Version: unspecified → Trunk
js> 1999.00 + 439.78 2438.7799999999997 js> (1999.00 + 439.78).toFixed(2) 2438.78 js> (1999).toString(2) 11111001111 js> (439.78).toString(2) 110110111.110001111010111000010100011110101110000101 js> (1999.00 + 439.78).toString(2) 100110000110.1100011110101110000101000111101011100001 Note the repeating fraction in base 2. This is the same result you'd get in C, C++, Java, Python, etc. etc. The toFixed(2) method call shown above shows the right way to cope. /be *** This bug has been marked as a duplicate of 5856 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.