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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,245c84afd1e393ce X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsmst01b.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr21.news.prodigy.com.POSTED!4988f22a!not-for-mail From: Newsgroups: comp.lang.ada References: <1581461.uQ1jN63t33@linux1.krischik.com> Subject: Re: What about big integers in Ada 2005? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: NNTP-Posting-Host: 64.164.117.94 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr21.news.prodigy.com 1128212825 ST000 64.164.117.94 (Sat, 01 Oct 2005 20:27:05 EDT) NNTP-Posting-Date: Sat, 01 Oct 2005 20:27:05 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1: TSU[@I_AOHV[RVT[AROR__TDFZ\@@FXLM@TDOCQDJ@_@FNTCCNSKQFCY@TXDX_WHSVB]ZEJLSNY\^J[CUVSA_QLFC^RQHUPH[P[NRWCCMLSNPOD_ESALHUK@TDFUZHBLJ\XGKL^NXA\EVHSP[D_C^B_^JCX^W]CHBAX]POG@SSAZQ\LE[DCNMUPG_VSC@VJM Date: Sun, 02 Oct 2005 00:27:05 GMT Xref: g2news1.google.com comp.lang.ada:5328 Date: 2005-10-02T00:27:05+00:00 List-Id: "Robert A Duff" wrote in message news:wccmzlu3127.fsf@shell01.TheWorld.com... > writes: > > > > I interepreted this question to refer to integers of arbitrary size such as > > those in Smalltalk. In Ada compilers, as with other language with > > implementations tied to the underlying platrform, numbers are related > > to the word size of the targeted machine. For example, I cannot define, > > on any Ada compiler that I know of, an Integer such as, > > > > type Number is range 0..2**78; > > > > since this would overflow contemporary (not future) architectures. In > > Smalltalk, > > and many other languages, we can do arithmetic on numbers such as, > > > > 34567345754784567745464478456345356675 > > and > > 99874257918340987932560129346591237523 > > > > Of course, this is not an inherent limitation of Ada. One can create a package > > to do this kind of arithmetic, but it is not all that easy to do so. > > One annoying thing is that every Ada compiler must implement such a > package, yet this package is not (portably) available to Ada > programmers. Some such package has to exist in every implementation, > because static expressions are evaluated with arbitrarily-large range at > compile time. But that functionality is not (standardly) available at > run time. Sigh. > > The other annoying thing is that even if you have such a package, you > have to use different (uglier) notations for various things (literals, > case statements, range constraints, etc). So if I want an integer range > 1..2**40, say, should I use an arbitrary-range arithmetic package and > write ugly-but-portable code? Or should I take advantage of a > particular Ada compiler that supports it? Neither choice is good. > > I happen to think "range 0..2**78" should be required of all Ada > implementations. Or even "0..2**(2**12)". > I am glad to see that we agree on this Bob. One of the key ideas of abstraction is that we are not limited to the underlying architecture of the hardware but can use that architecture in more creative ways. COBOL solved this problem years ago with its capability for variable length numbers via the PICTURE clause. Smalltalk, mentioned in my earlier post is particularly good at this kind of thing. One would think that Ada, with its emphasis on building good abstractions, would have support for it. Richard Riehle