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.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID,MAILING_LIST_MULTI,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,f127842852d2f03a X-Google-Attributes: gid103376,public From: Wilhelm.Spickermann@t-online.de (Wilhelm Spickermann) Subject: Re: About conversions Date: 2000/11/23 Message-ID: #1/1 X-Deja-AN: 697018330 Content-Transfer-Encoding: 8bit References: <200011230621.HAA17785@bulgaria.otn.eurocopter.de> X-Priority: 3 (Normal) X-Mailman-Version: 2.0beta5 X-BeenThere: comp.lang.ada@ada.eu.org Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 23 Nov 2000 11:00:13 GMT To: comp.lang.ada@ada.eu.org X-Sender: 0211750756-0001@t-dialin.net Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@enst.fr X-Trace: menuisier.enst.fr 974977213 9133 137.194.161.2 (23 Nov 2000 11:00:13 GMT) Organization: ENST, France List-Id: comp.lang.ada mail<->news gateway Newsgroups: comp.lang.ada Date: 2000-11-23T11:00:13+00:00 On 23-Nov-00 Christoph Grein wrote: > -14 mod 5: > > There's a common rule: ("Punkt vor Strich" in German) multiplication > (* / mod > rem) before addition (+ -), thus this is > > -14 mod 5 = -2**2 > > You wouldn't fall into the latter trap, would you? > > (Hope I'm correct, did not look it up in ARM :-) Sorry, but "mod x" always delivers values between 0 and x (x excluded). So the result is 1 and not -4. I do like this rule of operation, because adding or subtracting a multiple of the right operand to the left one will not change the result of the operation. It would be nice to have a corresponding division, such that A = (A / B) * B + A mod B. But the Ada definition of integer division is different -- I don�t know why -- and so we need "rem" instead of "mod" to make the above equation (and the one You have given) true. Wilhelm