From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Constraint error overflow
Date: Tue, 27 Apr 2021 17:59:57 +0200 [thread overview]
Message-ID: <s69cdq$796$1@gioia.aioe.org> (raw)
In-Reply-To: be95bd99-dc1e-44ec-ac26-a2bacc1e8f86n@googlegroups.com
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
next prev parent reply other threads:[~2021-04-27 15:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 14:04 Constraint error overflow Richard Iswara
2021-04-27 15:00 ` Dmitry A. Kazakov
2021-04-27 15:32 ` Richard Iswara
2021-04-27 15:38 ` Mark Lorenzen
2021-04-27 15:44 ` Shark8
2021-04-27 15:52 ` Jeffrey R. Carter
2021-04-27 15:59 ` Dmitry A. Kazakov [this message]
2021-04-28 7:03 ` Richard Iswara
2021-04-27 16:31 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox