Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: IE and IEE 754 Date: Wed, 27 Aug 2014 23:59:42 +0100 Organization: A noiseless patient Spider Lines: 20 Message-ID: <87fvgh1qu9.fsf@bsb.me.uk> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="30593"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Q+QdTmdk62tWi+0WJbEfwTlnocEexgVA=" Cancel-Lock: sha1:6dkCaQJqSREbAQ6WRD+oJGxegJw= sha1:AnCWjLnAJWvJBubPzGt9+i42Mv0= X-BSB-Auth: 1.5a7d19034606e6edf0c1.20140827235942BST.87fvgh1qu9.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:25748 "Christoph M. Becker" writes: > Evertjan. wrote: >> If you are a sticker for correctness and these are monitary values, >> like $ or [euro-sign], use integer cent values in variables, and >> write decimals with string manupulation. > > Are you suggesting that storing $123.45 as 12345 is better than storing > it as 123.45? As ECMAScript implementations typically have no integer > type, there is no difference regarding the precision of further > calculations. 12345 can be represented exactly in binary floating point (given enough bits, and we certainly have that) whereas 123.45 can't be. Whether this matters (and how much) depends on what calculations you go on to do, but I would call that a difference in precision from the get go. -- Ben.