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:70c1:: with SMTP id g1mr21750485qtp.147.1619538265083; Tue, 27 Apr 2021 08:44:25 -0700 (PDT) X-Received: by 2002:a25:424e:: with SMTP id p75mr18446578yba.161.1619538264928; Tue, 27 Apr 2021 08:44:24 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!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: Tue, 27 Apr 2021 08:44:24 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <48671e5c-8e9d-41c1-9ebc-2b4de6e0ed29n@googlegroups.com> Subject: Re: Constraint error overflow From: Shark8 Injection-Date: Tue, 27 Apr 2021 15:44:25 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61919 List-Id: On Tuesday, April 27, 2021 at 9:32:20 AM UTC-6, haujek wrote: > So the compiler is restricted to 32 bit integer value. I had hoped for 64 bit to get 18 digits. Depends on the compiler. You can always model your domain more explicitly: Bit_Size : Constant := 64; Bit_First : Constant := 0; Bit_Last : Constant := 2**Big_Bit_Size - 1; Type Big_Integer_Test is range Bit_First..Bit_Last with Size => Bit_Size; Function Factorial(Input:Big_Integer_Test) return Big_Integer_Test is (case Input is when 0 => 1, when 1 | 2 => Input, when others => Input * Factorial(Big_Integer_Test'Pred(Input)) );