From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: project euler 29 Date: Fri, 15 Sep 2023 18:34:21 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 15 Sep 2023 16:34:21 -0000 (UTC) Injection-Info: dont-email.me; posting-host="062f53d45a4aaf358284ad27508dd214"; logging-data="3418192"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18F4oCllPEWOOrV3BVXcBTYBE+HNCu7c+A=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Cancel-Lock: sha1:HWhZGTwhcwnh+82bS0YVG7qot9g= In-Reply-To: Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:65660 List-Id: On 2023-09-15 11:03, CSYH (QAQ) wrote: > As I know integer type is for 32 bits. but for this problem as me to find out the 2 ** 100 and even 100 ** 100. I missed this the first time. No, you don't know that Integer is 32 bits. ARM 3.5.4 (21) [http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-3-5-4.html] requires "In an implementation, the range of Integer shall include the range –2**15+1 .. +2**15–1." There are compilers for which Integer is less than 32 bits, so assuming otherwise is not portable. I know a lot of people don't care about portability, but I've also seen projects that spent large sums porting code that they thought didn't have to be portable. The cost of writing portable code is usually much smaller than the cost of porting non-portable code. Of course, you can always declare your own integer type with whatever range is appropriate for your problem, though the compiler doesn't always have to accept it. I don't know any compiler that doesn't accept 32-bit integer declarations, nor any targeting 64-bit platforms that doesn't accept 64-bit integers. But you're unlikely to find a compiler that will accept range 2 .. 101 ** 101 In King (https://github.com/jrcarter/King) the compiler must accept all integer type declarations. -- Jeff Carter "I didn't squawk about the steak, dear. I merely said I didn't see that old horse that used to be tethered outside here." Never Give a Sucker an Even Break 103