Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: IE and IEEE 754 (was: IE and IEE 754) Date: Wed, 27 Aug 2014 22:08:48 +0200 Organization: solani.org Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1409170122 24152 eJwNxMEBwCAIA8CVioSA44ia/Uew97hwGneCQYRCdv0rNnhd/52pkwuIVWHHOQd2NrwgDU17E9kQsw== (27 Aug 2014 20:08:42 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Wed, 27 Aug 2014 20:08:42 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-User-ID: eJwFwYEBgDAIA7CXQEaBc2ax/59gkgEH6yBxUik8rBXKNGbvxlqH80rRuBNT9a1pjUs2HT8g+RGX In-Reply-To: Cancel-Lock: sha1:qQjIYdI+nxkkuSJzQE9gsnolr9s= X-NNTP-Posting-Host: eJwFwYEBACAEBMCVKE/GSfz+I3SH7eovzOEGgoIJsYc6I3HIQjfnrqpEGPJ2qosqKmOG+wMmTBFv Xref: csiph.com comp.lang.javascript:25743 RobG wrote: > In most browsers: > > 0.57 + 8.36 + 3.36 + 0.19 = 12.479999999999999 > > in IE it returns: > > 12.479999999999998 > > Is IE wrong, or is the above difference allowable within IEEE 754? Both string representations will be parsed as the same double-precision 64-bit binary format IEEE 754 value[1]: 100000000101000111101011100001010001111010111000010100011110101 (Therefore: 12.479999999999999 === 12.479999999999998) The different string representation is allowed for conforming ECMAScript implementations according to ECMA-262 5.1 Edition, section 9.8.1 step 5[2]. [1] [2] -- Christoph M. Becker