Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site fortune.UUCP Path: utzoo!linus!decvax!decwrl!amd!fortune!phipps From: phipps@fortune.UUCP (Clay Phipps) Newsgroups: net.lang.c Subject: Pascal Modulus Operator / Re: Modulus Fn With Negatives Message-ID: <4179@fortune.UUCP> Date: Mon, 10-Sep-84 18:41:08 EDT Article-I.D.: fortune.4179 Posted: Mon Sep 10 18:41:08 1984 Date-Received: Sun, 16-Sep-84 10:33:59 EDT References: <212@digi-g.UUCP> Organization: Fortune Systems, Redwood City, CA Lines: 17 Pascal doesn't define its modulus operator for negative 'divisors'. To quote from ANSI/IEEE 770X3.97-1983 (the Pascal Standard), p. 73: A term of the form i mod j shall be an error if j is zero or negative, otherwise the value of i mod j shall be that value of (i-(k*j)) for integral k such that 0 <= i mod j < j. NOTE: Only for i >= 0 and j > 0 does the relation (i div j) * j + i mod j = i hold. -- Clay Phipps -- { amd hplabs!hpda sri-unix ucbvax!amd } !fortune!phipps { ihnp4 cbosgd decvax!decwrl!amd harpo allegra}