Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: % operator with negatives Message-ID: <540@taumet.com> Date: 15 Dec 90 20:15:26 GMT References: <1990Dec12.185714.7169@mp.cs.niu.edu> <1990Dec12.205416.26622@zoo.toronto.edu> <7461:Dec1310:04:0990@kramden.acf.nyu.edu> <1529@bbxsda.UUCP> Organization: Taumetric Corporation, San Diego Lines: 16 scott@bbxsda.UUCP (Scott Amspoker) writes: >Well I can really stir up the muck by pointing out that, by definition, > a mod 0 == a >Therefore, the method of dividing (a/b) does not always work since b could >legally equal 0. As has been pointed out before the "%" operator in C is NOT a mod operator, but a remainder operator. As such it is defined in terms of division; thus a%0 is undefined. (The ANSI standard explicitly says that a%0 is undefined.) -- Steve Clamage, TauMetric Corp, steve@taumet.com