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: Thu, 21 May 2015 21:40:45 +0100 Organization: A noiseless patient Spider Lines: 69 Message-ID: <87382pll4i.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="11377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EhUaz2c/ZWgNsBh66kh9snPKiFYygL8U=" Cancel-Lock: sha1:qQoT++QTghtvmQmCw4zBEaNMGs4= sha1:OKzeF6xHQ2vZR1u6d7Bm2pWZYU8= X-BSB-Auth: 1.a05f22dd54b4d84f011d.20150521214045BST.87382pll4i.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27799 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: >> >> >> >> > Den torsdag 21 maj 2015 kl. 17:01:39 UTC+2 skrev Ben Bacarisse: >> >> >> jonas.thornvall@gmail.com writes: >> >> >> >> >> >> > Feel free try to make it faster >> >> >> >> >> >> Optimising bad code is not an appealing project. >> >> >> >> >> >> The correct plan is to re-write it as a proper function and, what's >> >> >> more, make it a function that operates on some big number object type. >> >> >> >> >> >> > but still keep it general "anybase". >> >> >> >> >> >> It does not seem to permit any base. You claimed to be allowing >> >> >> arbitrary precision numbers as the base, but the code assumes that the >> >> >> base is an ECMAScript Number value. >> >> >> >> >> >> >> >> >> -- >> >> >> Ben. >> >> >> >> Is there any chance that I can persuade you to follow Usenet conventions >> >> and (1) snip signatures; (2) reply in-line to the points being made? >> >> >> >> > Actually it is infinite precision arithmetic, i have no idea what you >> >> > mean you simply feed it two times if you want decimals, and carry over >> >> > a 1 if to the second add if needed. There is no extra penalty in time >> >> > for that. The decimals Points is handled by the parser. >> >> > >> >> > 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]; > > You are very confused why do you think it is wrong? > 1,1 > Timing = 4 ms I get [0,1] using two command-line implementations and three browsers. > Think again ..........90+2 would be 1,0 comes out like this. > > 0,1 > Timing = 4 ms > > base=900719925474092; > var arrOne = [900719925474090]; > var arrTwo = [2]; What's this got to do with my example? Did you actually try my test case? -- Ben.