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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,726e9bcf769df489 X-Google-Attributes: gid103376,public From: Samuel Tardieu Subject: Re: Integer Division Date: 1998/08/05 Message-ID: #1/1 X-Deja-AN: 378234303 References: <6qa43u$eip$1@nnrp1.dejanews.com> Mail-Copies-To: sam@ada.eu.org To: jsanchor@cs5.dasd.honeywell.com Content-Type: text/plain; charset=US-ASCII Organization: TELECOM Paris Mime-Version: 1.0 (generated by tm-edit 7.108) Newsgroups: comp.lang.ada Date: 1998-08-05T00:00:00+00:00 List-Id: >>>>> "Jay" == jsanchor writes: Jay> Hi guys, I have a question. It is so simple that it seems Jay> stupid. I was doing a simple arithmetic operation 10/3. Now, I Jay> want the INTEGER division to return the next whole number Jay> (i.e. 4). I know in floating_point type they have an attribute Jay> called 'Ceiling. What about integer types? Currently, I am doing Jay> a division operation B := A/3, & then a 'rem' operation if A rem Jay> 3 /= 0 then B = B + 1; Is there a nicer method? If you work with positive numbers, B := (A + 2) / 3; will do the job (and (A+(D-1))/D in general). Sam -- Samuel Tardieu -- sam@ada.eu.org