From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.198.65 with SMTP id w62mr2017935iof.105.1519928118169; Thu, 01 Mar 2018 10:15:18 -0800 (PST) X-Received: by 10.157.4.22 with SMTP id 22mr131984otc.2.1519928118069; Thu, 01 Mar 2018 10:15:18 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!e10no607377itf.0!news-out.google.com!a2ni3402ite.0!nntp.google.com!w142no1183685ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 1 Mar 2018 10:15:17 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.233.194; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.233.194 References: <421d1598-68d7-4d0b-b596-6e9c59cf865c@googlegroups.com> <877eqxe7u8.fsf@nightsong.com> <87muzsz6s2.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <628c3bba-6c0d-495b-be2f-e6ed3ef3418f@googlegroups.com> Subject: Re: 64-bit unsigned integer? From: "Dan'l Miller" Injection-Date: Thu, 01 Mar 2018 18:15:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3595 X-Received-Body-CRC: 3567096766 Xref: reader02.eternal-september.org comp.lang.ada:50760 Date: 2018-03-01T10:15:17-08:00 List-Id: Dmitry A. Kazakov wrote: > That replaces unpredictable penalty with a predictably prohibitive one.= =20 Why is it prohibitive? > Shuffling arrays of machine words for each arithmetic operation is a=20 > non-starter.=20 What precisely is =E2=80=9Cshuffling=E2=80=9D here? (Certainly pejorative = slang here, not shuffling as in cards.) Bignum integers would simply be a = binary form of string where the library performs for modern processors an e= xtrapolation of what we used to do on 6502 processors to get more than 8-bi= t arithmetic: e.g., for addition, add each N-bit =E2=80=9Cdigit=E2=80=9D a= s in elementary-school-esque positional-numeral addition notation plus carr= y-flag from the N-bit digit to the immediate right, where N=3D8 on 8-bit pr= ocessors that lacked 16-bit or 32-bit arithmetic instructions such as the 6= 502, N=3D64 on 64-bit processors, and N=3D32 on 32-bit processors. I'm not= seeing the =E2=80=9Cshuffling=E2=80=9D problem here; bignum's array of mac= hine words just looks like garden-variety positional numerals, merely in an= enormous radix-base instead of base 2, 8, 10, or 16 for each digit that hu= man beings consider convenient for manual arithmetic calculations. And the= re was a time as recently as the mid-1980s with 6502-family processors wher= e nearly =E2=80=A2every=E2=80=A2 serious programmer on that platform just k= new how to manage bignum-esque arithmetic in base 256, because that is effe= ctively how we did 16-bit and 32-bit arithmetic on the 6502. As such, perhaps yes, setting an upper bound on the size of each bignum arr= ay is desirable and perhaps the more-mainstream case compared to unbounded,= so that, say, O(n=CB=A3) operations have a knowable maximum computation ti= me (as well as the obvious maximum memory allocation) at engineering-time f= or x > 1. Also, perhaps knowing that I am going to get exactly 128-bit int= egers makes some other portion of the design more practical (e.g., record l= ayout where the 128-bit integer is placed in situ within the record, instea= d of allocated separately as potentially-varying size).