Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.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: Mon, 04 May 2015 15:39:30 +0100 Organization: A noiseless patient Spider Lines: 26 Message-ID: <87ioc8e7a5.fsf@bsb.me.uk> References: <66061bf2-9092-42a5-918e-5a039a53db20@googlegroups.com> <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> 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="14154"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5q88gihNkeQsiCp0DkwurEWPlagjWS3A=" Cancel-Lock: sha1:D2rZ8cnd6ODCq+GC1MxPy+7a5EI= sha1:/bXy+rh1byMHbvmSNzbTpqA+YKs= X-BSB-Auth: 1.33e94e5fef0630a61261.20150504153930BST.87ioc8e7a5.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27485 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 do not see how you would get away either multiplication or division > if the base itself cause overflow. Not that it is implemented to no > cause overflow in my implementation right now, but since i do use it > for multiplication it do have to be stored in an Array. The fastest algorithms usually use as large a base as possible without causing overflow for single digit multiplications. -- Ben.