From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.148.196 with SMTP id l187mr4279211ywg.3.1496836079882; Wed, 07 Jun 2017 04:47:59 -0700 (PDT) X-Received: by 10.157.11.208 with SMTP id 74mr715681oth.16.1496836079842; Wed, 07 Jun 2017 04:47:59 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!y44no86765qth.1!news-out.google.com!m134ni711itb.0!nntp.google.com!67no138883itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 7 Jun 2017 04:47:59 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2407:7000:9005:4020:a8f7:30ad:5b15:cf95; posting-account=g6PEmwoAAADhFsmVm6Epjviaw4MLU0b5 NNTP-Posting-Host: 2407:7000:9005:4020:a8f7:30ad:5b15:cf95 References: <35c6ac5a-3295-4fa4-8545-ca76c113dde4@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6f8707d3-a5a2-48f2-8c16-8eed3fa333f9@googlegroups.com> Subject: Re: Arrays in Ada 2012 From: Anatoly Chernyshev Injection-Date: Wed, 07 Jun 2017 11:47:59 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:46910 Date: 2017-06-07T04:47:59-07:00 List-Id: 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.