From mboxrd@z Thu Jan 1 00:00:00 1970 To: erik quanstrom , Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] More Microsoft bashing In-Reply-To: Your message of "Thu, 15 Dec 2005 22:53:06 CST." <20051216045306.126521B12F3@dexter-peak.quanstro.net> References: <6e35c0620512152004n37c06ff5wd250424db50d874d@mail.gmail.com> <20051216045306.126521B12F3@dexter-peak.quanstro.net> Date: Fri, 16 Dec 2005 10:47:46 +0000 From: John Stalker Message-ID: <200512161047.aa99386@salmon.maths.tcd.ie> Cc: Topicbox-Message-UUID: c9245b60-ead0-11e9-9d60-3106f5b1d025 > | > | So, what *is* -5 MOD 3? > | > > -2 I hope not. If you are really serious about using modular arithmetic then you probably want to use something like PARI GP where -5 mod 3 is -5 mod 3, belonging to the data type of integers mod 3. -2 mod 3 and 1 mod 3 are alternate representations of the same value. If you aren't serious about modular arithmetic and want the result to be an integer then I think you are shooting yourself in the foot if you implement it as anything other than -5 mod 3 == 1. I want to be able to test whether n is odd with `if ( n % 2 == 1 ) ...' Of course, I'm a mathematician rather than a CS person, but I think the other convention has nothing to recommend it. -- John Stalker University of Dublin, Trinity College School of Mathematics