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=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: advent of code day 10 Date: Sat, 12 Dec 2020 23:25:41 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <865z59c8p6.fsf@stephe-leake.org> <3082b617-c2b8-47b5-b0e1-465598271c51n@googlegroups.com> <86ft4apymv.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 12 Dec 2020 22:25:43 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="bce7be6a5db2cd8595d01c78d52b9460"; logging-data="4750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MpiAKccegPMukX7YBSXxUFQ2HNVgrg4Y=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 Cancel-Lock: sha1:+ZoWxN9MUSK3yFjk7Vhx178yHsY= In-Reply-To: <86ft4apymv.fsf@stephe-leake.org> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:60815 List-Id: On 12/12/20 9:17 PM, Stephen Leake wrote: > "gautier...@hotmail.com" writes: > >> On Friday, December 11, 2020 at 4:39:36 AM UTC+1, Stephen Leake wrote: >>> the final total is larger than 64 bits >> The total for your data is 3022415986688, it holds in 42 bits... > > hmm. I got constraint error when I used Long_Integer; maybe that's not > 64 bits? Using Ada.Big_Numbers.Big_Integers was a good exercise anyway. That sounds like C thinking. If you need 64 bits, say so, don't hope that optional language-defined types will be big enough. type S is range -(2 ** 63) + 1 .. 2 ** 63 - 1; type U is mod 2 ** 64; I used type U is mod System.Max_Binary_Modulus; -- Jeff Carter "Frankie Wolf, wanted by Federal authorities for dancing with a mailman." Take the Money and Run 143