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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,18069d15345a10c8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-29 03:35:55 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!EU.net!Germany.EU.net!Munich.Germany.EU.net!thoth.mch.sni.de!horus.mch.sni.de!D012S436!chris From: chris@D012S436.mch.sni.de (Christopher Costello) Newsgroups: comp.lang.ada Subject: Re: Modulus and Remainder operations (Was Re: Help with a bit of C code) Date: 29 Sep 1994 09:04:17 GMT Organization: Siemens Nixdorf AG Message-ID: <36dvuh$qcj@horus.mch.sni.de> References: <940927104030.20400d35@v22bz.npt.nuwc.navy.mil> <36bsmq$5p@gnat.cs.nyu.edu> NNTP-Posting-Host: d012s436.mch.sni.de X-Newsreader: TIN [version 1.2 PL1] Date: 1994-09-29T09:04:17+00:00 List-Id: Robert Dewar (dewar@cs.nyu.edu) wrote: : In traditional C, the result of applying / or % to negative integers is : implementation dependent and hence undefined at the language level. Likely : it will be remainder type semantics rather than modulus type semantics : because most machines do things that way by default, but on the ICL1900 : series C gave modular semantics, since that's the way the machine was. : I think this is unchanged in the ANSI C standard, can someone confirm this? In the ANSI standard, section 3.3.5 it says: "... If either operand is negative, whether the result of the / operator is the largest integer less than or equal to the algebraic quotient or the smallest integer greater than or equal to the algebraic quotient is implementation defined, as is the sign of the result of the % operator." I'd rather bite my tongue off than engage in language wars. Maybe. -- +--------------------------------------------------------------------------+ | SIEMENS Christopher Costello Tel: +49 89 636 40367 | | ======= SNI BU BA NM 123 Fax: +49 89 636 45860 | | NIXDORF Muenchen, Germany E-mail: Christopher.Costello@mch.sni.de | +--------------------------------------------------------------------------+