Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.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: Optimise adder Date: Fri, 22 May 2015 00:10:09 +0100 Organization: A noiseless patient Spider Lines: 51 Message-ID: <87fv6pjzn2.fsf@bsb.me.uk> References: <874mn6m0tt.fsf@bsb.me.uk> <140fbc59-9fd9-41dd-bcb5-55b8c304e5b8@googlegroups.com> <87vbfllxxb.fsf@bsb.me.uk> <69862aa5-cdf8-4d22-beca-c37c59b90e63@googlegroups.com> <87egm9lpmh.fsf@bsb.me.uk> <2823f00c-b09d-45df-b14c-5eadf3d141b8@googlegroups.com> <87382pll4i.fsf@bsb.me.uk> <5c25f904-8d8f-46e9-8366-d8263c30f23a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="16491"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Miz0L+fYt9qEW8s8lXmEtku+KVjPAp2E=" Cancel-Lock: sha1:NImnrCbcYT6vGuJlBsGh7FBjgtM= sha1:qIVY0bxsqqcWOBGVK8GM/g2a2i8= X-BSB-Auth: 1.190f8d0795d89f35481e.20150522001009BST.87fv6pjzn2.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27805 jonas.thornvall@gmail.com writes: > Den torsdag 21 maj 2015 kl. 22:40:50 UTC+2 skrev Ben Bacarisse: >> jonas.thornvall@gmail.com writes: >> >> > Den torsdag 21 maj 2015 kl. 21:03:40 UTC+2 skrev Ben Bacarisse: >> >> jonas.thornvall@gmail.com writes: >> >> >> >> > Den torsdag 21 maj 2015 kl. 18:04:22 UTC+2 skrev Ben Bacarisse: >> >> >> jonas.thornvall@gmail.com writes: >> >> >> > It permit anybase, but you have to format your number into that base >> >> >> > Before feeding the function, try base two. >> >> >> >> >> >> The code you posted does not permit any base. >> >> > >> >> > Not true, here i changed base same code, different number format. >> >> >> >> Yes, true. Here's a test case for you: >> >> >> >> base=9007199254740992; >> >> var arrOne = [base-1]; >> >> var arrTwo = [2]; > Yes i did and i got 1,1 in any brwoser. I'm having a hard time believing you. Partly because you've posted two examples that *look* similar but are, in fact, different (so maybe you have a typo somewhere in your test), partly because I've just tried another two implementations and I can't get anything but [0,1] in any of them, but mostly because I know how ECMAScript Numbers are defined so I know how these numbers get processed by your function. > For your example, except you do apparently wrong when defining arrOne base-1. > Try arrOne = [9007199254740991] Yes, I did that. Two command-line implementations and (now) five browsers all gave the same incorrect result. Put your test case (i.e. for base = 9007199254740992, arrOne = [9007199254740991] and arrTwo = [2]) on a public page and I'll try it with the browsers I have. > The error is not in the function... > So apparently you are doing a nono... How well does the code work with base 1,000,000,000,000,000,000,000,000,000, 000,000,000,000,000,000,000,000,000,000,000? What about base 2^1024? This test case aside, your code does not permit the use of any base. -- Ben.