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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3b4bed4f74b8ac49 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: GNAT messages and the not operator (pitfall alert!) Date: 1996/10/30 Message-ID: <01bbc5fe$823691c0$308371a5@dhoossr.iquest.com>#1/1 X-Deja-AN: 193059409 distribution: world references: <32762A30.D2D@watson.ibm.com> <1996Oct29.145959.1@corning.com> content-type: text/plain; charset=ISO-8859-1 organization: DBH Enterprises, Inc. mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-10-30T00:00:00+00:00 List-Id: whiting_ms@corning.com (Matt Whiting) wrote in article <1996Oct29.145959.1@corning.com>... > In article <32762A30.D2D@watson.ibm.com>, "Norman H. Cohen" writes: > > Robert Dewar wrote: > >> > >> Here is another pitfall, pretty horrible if it hits, but fortunately rare. > >> Ask an Ada expert what is the value of > >> > >> -5 mod 3 > > > > I agree this is a nasty one, and Ada as a Second Language explicitly > > warns about it (bottom of page 245), as well as about the only slightly > > less insidious > > Relative to the page 245 warning and the table on page 246, I'm still confused. > I'm probably beating a dead horse here, but something still doesn't seem right. > If I'm reading the p. 246 table correctly, -5 mod 4 (row 1, column 4, excluding > the "header row and column"), should evaluate to 3. However, I just wrote a > simple little program using ObjectAda V7.0 which evaluates to -1, which, BTW, > is what I would have expected. Taking into account the warning on p. 245, I > also tried -(5 mod 4). It does give the identical -1 result. Am I reading the > table incorrectly? > > Matt > -5 mod 4 = -(5 mod 4) = -1, but (-5) mod 4 = 3 Is it clear now? -- David C. Hoos, Sr., http://www.dbhwww.com http://www.ada95.com