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: Overflow, integers and strings Date: Tue, 05 May 2015 01:10:59 +0100 Organization: A noiseless patient Spider Lines: 50 Message-ID: <87y4l3dgto.fsf@bsb.me.uk> References: <6ca07e69-1694-49c1-93eb-748c44d8ab68@googlegroups.com> <871tj08vrb.fsf@bsb.me.uk> <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> <308b20cc-7c68-4828-badd-5213ef2107b3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="20081"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sMHyjYzV4JqP45QgLFUfglAuLpZZheu0=" Cancel-Lock: sha1:kjOw6SvNZD83/zR+Qk7o2H0PVqQ= sha1:6KNt2jqh05ozyq/EGDi5czsm7a4= X-BSB-Auth: 1.0f9b8c79b11ba0eeaf22.20150505011059BST.87y4l3dgto.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27528 jonas.thornvall@gmail.com writes: > Den måndag 4 maj 2015 kl. 16:28:09 UTC+2 skrev Ben Bacarisse: >> jonas.thornvall@gmail.com writes: >> >> > Den måndag 4 maj 2015 kl. 15:01:44 UTC+2 skrev Ben Bacarisse: >> >> jonas.thornvall@gmail.com writes: >> >> >> >> > This is only an outline / pseudocoe for how the base conversion would >> >> > look with bignumb implementation will look. You have to check the >> >> > arrays so they contain intergers and not chars, that is probably what >> >> > fail in first loop. >> >> >> >> There is no value in using a bugnum for the base in a bignum >> >> implementation. This whole part of the project is a waste of time >> >> (unless you just want learn ECMAScript programming but that seems >> >> unlikely). >> > >> > I can see that the implementation faster multiplying in base 2048 >> > rather than base 2, although it right now cause overflows if number >> > outside integer scope for all bases other than 10. >> >> I can't follow this. > > There is nothing to follow i say the higher base my implementation use > the faster arithmetic. Of course it could be due to my implementation, > but it isn't > it is due to the weight of the digiplaces. What is the optimum base for a calculation like AxB? Presumably it depends of the sizes of A and B. According to you, as the base increases, the calculation gets faster. But once the base is so large that A, B and AxB are all single digits, making it bigger won't help. This means there is an optimum size. You current argument implies that this optimum base is AxB+1 (or there abouts). The calculation is then just a single digit multiplication, but those digits are bignums themselves. What is the optimum base for *these* bignums? Do you see the problem now? >> > I will fix that though, and that it will becom apparent when >> > multiplying big numbers which approach is faster. >> > >> > Binary base or bignumb base. Does this mean you don't know that a bignum base will be faster? You seemed to be saying that you did know. -- Ben.