Path: csiph.com!usenet.pasdenom.info!gegeweb.org!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 11:25:48 +0100 Organization: A noiseless patient Spider Lines: 85 Message-ID: <87pp5sj4cz.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> <87fv6pjzn2.fsf@bsb.me.uk> <81ccaab4-6fe5-47da-b626-3f3fe11b9829@googlegroups.com> <87vbflhroi.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="7156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194GfS3bTNTD37Xk7Iv0DX35PIYHlbKlVc=" Cancel-Lock: sha1:V1U3AU00+5CFibwD6NFgJsPlhsA= sha1:AkXt+tm0eRjfPpetVERPrFiK8Fs= X-BSB-Auth: 1.e2d1a4d7c5ef49746142.20150522112548BST.87pp5sj4cz.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27814 jonas.thornvall@gmail.com writes: > Den fredag 22 maj 2015 kl. 11:45:06 UTC+2 skrev Ben Bacarisse: >> jonas.thornvall@gmail.com writes: >> >> > Den fredag 22 maj 2015 kl. 01:10:16 UTC+2 skrev Ben Bacarisse: >> >> 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. >> >> >> > Iexplorer, firefox and Chrome all give the correct answer 1,1 >> >> Yes, of course. That's not the test case I gave you. >> >> > http://jt.node365.se/add.html >> >> I was right not to believe you and I am not 100% sure it was a genuine >> mistake. >> >> -- >> Ben. > > What to you mean do you suggest that, my function responsible for > base-1 in your definition of the array? That must be javascript doing > something weird not the function or? I do not think i understand what > you mean, please clarify? I posted an example base that does not work. You copied it incorrectly and claimed my example was wrong, when the error was in your copying. > If it bugs out on base - 1 but not on var arrOne = [900719925474091]; > it certainly can not be because of the function? > > base=900719925474092; That was not the base I gave you. I wrote: base=9007199254740992. > var arrOne = [900719925474091]; //Is different from base-1? I suggested 9007199254740991 and you actually said that you have tried that number but the code posted today used this other number. > var arrTwo = [2]; -- Ben.