Xref: utzoo comp.theory:351 comp.misc:8231 comp.lang.misc:4143 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aipdc From: aipdc@castle.ed.ac.uk (Paul D. Crowley) Newsgroups: comp.theory,comp.misc,comp.lang.misc Subject: Re: Modulus (Re: hashing function for strings) Message-ID: <2367@castle.ed.ac.uk> Date: 19 Feb 90 18:30:48 GMT References: <1990Feb15.211210.22950@max.sunysb.edu> <0ZqzBRm00WA1M0d5JZ@andrew.cmu.edu> <7416@ogicse.ogc.edu> <10940@saturn.ADS.COM> Reply-To: aipdc@castle.ed.ac.uk (Paul D. Crowley) Organization: Edinburgh University Computing Service Lines: 17 In article flee@shire.cs.psu.edu (Felix Lee) writes: >There are three things that most people would like: > quotient = -5 div 3 = -(5 div 3) = -1 > remainder = -5 mod 3 = (-5 + 6) mod 3 = 1 > 3*quotient + remainder = -5 > >Unfortunately, they're mutually contradictory. You must choose one of >them to violate. Someone will be unhappy with your decision. I'd _hate_ a computer that obeyed the first of these. To me, -5 div 3 is -2. -5 div 3 = int(-5/3) = int(-1.666) = -2 Then again, I think month and day numbers should start at 0. -- \/ o\ "I say we grease him right away. No offense." - Aliens. /\__/ Paul D Crowley aipdc@uk.ac.ed.castle