comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@dr_no.mitre.org (Robert I. Eachus)
Subject: But it is possible....
Date: Thu, 25 Mar 1993 22:02:12 GMT
Date: 1993-03-25T22:02:12+00:00	[thread overview]
Message-ID: <EACHUS.93Mar25170212@dr_no.mitre.org> (raw)
In-Reply-To: eachus@dr_no.mitre.org's message of Thu, 25 Mar 1993 21:29:15 GMT


    I realized just as I sent the preceding message that it is
possible to modifiy Keith's code to make it portably static.  Just
replace Integer'LAST with Integer'POS(Integer'LAST).  This makes both
arguments to ">" of type universal_integer instead of STANDARD.Integer.
(About six AI references omitted to avoid terminal language-lawyeritis.)

    Unfortunately, that makes the code even more ugly.  Maybe if you
write it as a single (big!) expression:

   Largest_Power_Of_Ten: constant := 10 ** (
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 1) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 2) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 3) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 4) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 5) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 6) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 7) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 8) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 9) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 10) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 11) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 12) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 13) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 14) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 15) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 16) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 17) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 18) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 19) +
      Boolean'POS(Integer'POS(Integer'LAST) > 10 ** 20));

    At least this way it doesn't pollute the name space. But I still
don't think I'll put it in the next version of ADAR.


					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



      reply	other threads:[~1993-03-25 22:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-19 21:16 Ada Decimal Arithmetic & Representations (ADAR) V1.0 available Michele L. Kee (AdaIC)
1993-03-21 23:12 ` Michael Feldman
1993-03-22  9:53   ` Rolf EBERT
1993-03-22 22:33     ` Keith Thompson @pulsar
1993-03-24  1:33       ` Robert I. Eachus
1993-03-25  1:22         ` Keith Thompson @pulsar
1993-03-25 21:29           ` Robert I. Eachus
1993-03-25 22:02             ` Robert I. Eachus [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