comp.lang.ada
 help / color / mirror / Atom feed
From: Anatoly Chernyshev <achernyshev@gmail.com>
Subject: Re: Arrays in Ada 2012
Date: Wed, 7 Jun 2017 04:47:59 -0700 (PDT)
Date: 2017-06-07T04:47:59-07:00	[thread overview]
Message-ID: <6f8707d3-a5a2-48f2-8c16-8eed3fa333f9@googlegroups.com> (raw)
In-Reply-To: <oh88l2$gsf$1@gioia.aioe.org>

On Wednesday, June 7, 2017 at 7:06:13 PM UTC+12, Dmitry A. Kazakov wrote:
> On 06/06/2017 22:56, Randy Brukardt wrote:
> 
> >         Current := Current + Long_Long_Integer'Size/Storage_Unit;
> 
> A bit OT question.
> 
> I always use rounding in the corresponding cases
> 
>     (Long_Long_Integer'Size + Storage_Unit - 1) / Storage_Unit;
> 
> Is this an overkill from the point of view the permissions RM gives to 
> array implementation?
> 

Miserable life of a computer scientist...

Couple of minor questions:

1 (to Dmitry): Aren't you screwing up the whole idea when using plain '1' in the formula above?

2 (to Randy): Would it be more convenient to declare a constant 'one' in the package, e.g. 
ll1: constant long_long_integer:=Long_Long_Integer'Size/Storage_Unit;
and use it throughout when dealing with long_long_integers? So that, to stay on the bright side, every l_l_int operation would be brought into error-proof shape by multiplying by this constant: Current:=ll1*(current+1);

PS: Thanks to everyone answered, that's what I wanted to know.

  reply	other threads:[~2017-06-07 11:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 11:47 Arrays in Ada 2012 Anatoly Chernyshev
2017-06-06 12:17 ` Dmitry A. Kazakov
2017-06-06 13:17   ` Simon Wright
2017-06-06 13:57     ` Dmitry A. Kazakov
2017-06-06 21:59       ` Simon Wright
2017-06-06 13:19 ` AdaMagica
2017-06-06 20:56   ` Randy Brukardt
2017-06-07  7:06     ` Dmitry A. Kazakov
2017-06-07 11:47       ` Anatoly Chernyshev [this message]
2017-06-07 12:15         ` Dmitry A. Kazakov
2017-06-08  0:55         ` Randy Brukardt
2017-06-08  0:51       ` Randy Brukardt
2017-06-08  7:07         ` Dmitry A. Kazakov
2017-06-09  3:23           ` Randy Brukardt
2017-06-18  2:14 ` Arrays in Ada 2020 Ivan Levashev
2017-06-18  3:00   ` Nasser M. Abbasi
2017-06-18 12:06     ` Robert Eachus
2017-06-18 20:15       ` Simon Wright
2017-06-20 13:33         ` Robert Eachus
2017-06-19  6:36       ` Ivan Levashev
2017-06-19 12:06         ` AdaMagica
2017-06-23  1:17           ` Randy Brukardt
2017-06-18 20:15     ` Pascal Obry
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox