Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!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 20:01:51 +0100 Organization: A noiseless patient Spider Lines: 49 Message-ID: <87egm9lpmh.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="16923"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Weeir0k3X+3ltWy1NpmboRQ2USojp6Cs=" Cancel-Lock: sha1:oEdAe1G/kh+jKpfuKQ/PvEtDgiU= sha1:iym+r145Q/Ra4/6mUcTzF8UEllI= X-BSB-Auth: 1.73cf4899bb64a44bb565.20150521200335BST.87egm9lpmh.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27796 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]; -- Ben.