From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: project euler 29
Date: Fri, 15 Sep 2023 18:34:21 +0200 [thread overview]
Message-ID: <ue212d$38a2g$1@dont-email.me> (raw)
In-Reply-To: <beaa0494-5783-4130-b96f-1a5271466678n@googlegroups.com>
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
prev parent reply other threads:[~2023-09-15 16:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 9:03 project euler 29 CSYH (QAQ)
2023-09-15 9:50 ` Jeffrey R.Carter
2023-09-15 18:04 ` Keith Thompson
2023-09-15 15:42 ` Ben Bacarisse
2023-09-16 10:07 ` Francesc Rocher
2023-09-16 20:59 ` Ben Bacarisse
2023-09-16 21:56 ` Ben Bacarisse
2023-09-17 18:56 ` Francesc Rocher
2023-09-17 22:54 ` Paul Rubin
2023-09-17 23:08 ` Ben Bacarisse
2023-09-18 0:09 ` Paul Rubin
2023-09-18 0:16 ` Ben Bacarisse
2023-09-18 5:16 ` Paul Rubin
2023-09-18 11:31 ` Ben Bacarisse
2023-09-18 13:04 ` Francesc Rocher
2023-09-18 14:20 ` Ben Bacarisse
2023-09-18 16:55 ` Francesc Rocher
2023-09-18 19:22 ` Ben Bacarisse
2023-09-18 19:38 ` Paul Rubin
2023-09-18 19:52 ` comp.lang.ada
2023-09-18 19:56 ` comp.lang.ada
2023-09-18 20:01 ` Ben Bacarisse
2023-09-15 16:34 ` Jeffrey R.Carter [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox