Xref: utzoo comp.theory:388 comp.misc:8325 comp.lang.misc:4263 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!charon!steven From: steven@cwi.nl (Steven Pemberton) Newsgroups: comp.theory,comp.misc,comp.lang.misc Subject: Re: What if the Divisor is Negative? (was Re: Modulus) Message-ID: <8839@boring.cwi.nl> Date: 26 Feb 90 14:11:33 GMT References: <4356@daffy.cs.wisc.edu> Sender: news@cwi.nl (The Daily Dross) Reply-To: steven@valk.cwi.nl.UUCP (Steven Pemberton) Followup-To: comp.theory Organization: CWI, Amsterdam Lines: 18 In article callahan@cs.psu.edu (Paul B. Callahan) writes: > Thus, we define > m div n = floor(m/n) > m mod n = m - n*(m div n) [...] > Another nice thing about this definition is that m and n need not be > integers. In fact, if n is 2*pi and and m is some arbitrary real, > then we can use this formula to force an angle into the interval [0,2*pi). And you can get the fractional part of m with m mod 1 For an example of a language that adopts this approach (and gets mod right :-), see ABC, recently posted to the net. Steven Pemberton, CWI, Amsterdam; steven@cwi.nl "Let us go then you and I/while the night is laid out against the sky/like a smear of mustard on an old pork pie" Nice poem Tom. I have ideas for changes though, why not come over? - Ezra