From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:6703:: with SMTP id e3mr25176798qtp.247.1619593430480; Wed, 28 Apr 2021 00:03:50 -0700 (PDT) X-Received: by 2002:a25:9c86:: with SMTP id y6mr7066728ybo.405.1619593430247; Wed, 28 Apr 2021 00:03:50 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 28 Apr 2021 00:03:50 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=36.85.88.151; posting-account=oy9pPgoAAACICsEVtbydIrxpi9tsYOGl NNTP-Posting-Host: 36.85.88.151 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Constraint error overflow From: Richard Iswara Injection-Date: Wed, 28 Apr 2021 07:03:50 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61924 List-Id: On Tuesday, April 27, 2021 at 10:59:57 PM UTC+7, Dmitry A. Kazakov wrote: > On 2021-04-27 17:32, Richard Iswara wrote: > > On Tuesday, April 27, 2021 at 10:00:22 PM UTC+7, Dmitry A. Kazakov wrote: > >> On 2021-04-27 16:04, Richard Iswara wrote: > >>> Ada beginner here. I was trying to multiply the first 100 integer and GNAT throw me a constraint error, overflow. I check the error was on integer 13. So what did I do wrong here? > >> Nothing, it is just so that > >> > >> 14! > 2**31 - 1 > > So the compiler is restricted to 32 bit integer value. I had hoped for 64 bit to get 18 digits. > That won't give you 100! That is 158 digits or so. > > Long_Float gamma function should do the trick, or arbitrary precision > integer arithmetic. > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de Thank you all of you who responded and give very helpful advices. i am very much an amateur beginner in programming . .