Closed Bug 221816 Opened 21 years ago Closed 21 years ago

wrong sum

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 20140

People

(Reporter: roger, Assigned: rogerl)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; pt-BR; rv:1.4) Gecko/20030624 Netscape/7.1 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; pt-BR; rv:1.4) Gecko/20030624 Netscape/7.1 doing 1.1 + 2.2 in javascript isn't returning 3.3 as expected, it returns 3.3000000000000003 It also happens with 10.1 + 20.2 and 100.1 + 200.2 To simply reproduce, type on the location bar: javascript:alert(1.1 + 2.2); Reproducible: Always Steps to Reproduce:
Mozilla is following the appropriate standards here--the issue centers around trying to represent base-10 numbers in a computer that does base-2 math. See the references in bug 20140 for more info. You'll have to round up (w/ 2 digits after the decimal point) before you present it to the user. PS : same 'error' in Internet Explorer ... that should make you think. *** This bug has been marked as a duplicate of 20140 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
konqueror doesn't have this 'error'... must open a bug to fix it! ;) Thanks for the info.
Status: RESOLVED → VERIFIED
> konqueror doesn't have this 'error'... must open a bug to fix it! ;) FYI: There is a KDE bug for rounding the wrong way, and it has been marked fixed last week: http://bugs.kde.org/show_bug.cgi?id=51684 . Konqueror 3.2 should behave exactly as Mozilla, Opera and IE do.
You need to log in before you can comment on or make changes to this bug.