Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Overflow, integers and strings Date: Tue, 05 May 2015 00:45:33 +0100 Organization: A noiseless patient Spider Lines: 29 Message-ID: <87r3qvdgrh.fsf@bsb.me.uk> References: <1997740.h7VUlrh2Em@PointedEars.de> <72e44d34-7f4d-4d32-8304-e73688132274@googlegroups.com> <3770518e-e91f-4368-9a69-cbd2f2461343@googlegroups.com> <87lhh5zmuy.fsf@bsb.me.uk> <9e56ec52-91b5-4e3e-9206-fd970fa69254@googlegroups.com> <2a1bdab8-bc0e-4a82-bce5-37c151ba4b47@googlegroups.com> <87zj5kebta.fsf@bsb.me.uk> <87oam0e7t7.fsf@bsb.me.uk> <1a007e67-3a14-424d-b480-c2d909c1f553@googlegroups.com> <87d22ge76i.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="20081"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MGN8LRZY6RY+ua4JgYvaeWWc4XUhZ8Jk=" Cancel-Lock: sha1:59FAIO/sSXqEbN0FnAeZlplkY3Q= sha1:VeFHF1XS2ZBuc83QUc2/fXVGxw0= X-BSB-Auth: 1.7b728d39da5857a43d7d.20150505011218BST.87r3qvdgrh.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27529 "Christoph M. Becker" writes: > Evertjan. wrote: > >> wolfgang zeidler wrote on 04 mei 2015 in >> comp.lang.javascript: >> >>> Likely base 2^16 would also work correct, but I was too lazy to check >> this. >> >> There is no question that correct code will work correctly in any form. >> That is why it is called correct code. >> >> In Javascript 2^32 comes to mind, in which case you can use much of the >> internal engine. > > Consider that conforming ES implementations are not required to do any > integer arithmetic. They are, however, required to perform a large set of calculations exactly. These include many calculations involving integers which have exact floating point representations. I phrase it like this because I'm not exactly sure what you meant, but the end result is that ES appears to do integer arithmetic for a certain range of values. -- Ben.