From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <775b8d190512152138g7ffaa837oe193f1556392a721@mail.gmail.com> Date: Fri, 16 Dec 2005 16:38:16 +1100 From: Bruce Ellis 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: <20051216053346.F1BC41B12F7@dexter-peak.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6e35c0620512152004n37c06ff5wd250424db50d874d@mail.gmail.com> <20051216045115.GC15067@augusta.math.psu.edu> <20051216050214.GD15067@augusta.math.psu.edu> <20051216053346.F1BC41B12F7@dexter-peak.quanstro.net> Cc: Topicbox-Message-UUID: c90fea9a-ead0-11e9-9d60-3106f5b1d025 horseshitt. read. brucee On 12/16/05, erik quanstrom wrote: > you've got to take you're math cap off, and put your cs cap on. > > the motivation for defining MOD and DIV is so you can do somethign > like this > > row =3D size DIV columns > col =3D size MOD columns > > the pseudo-mathematics is applied ex post facto. clearly you have to > get a single value out of the operation but that value is never going to > be a member of Z. it's going to be a n-bit binary integer. also, > > ; cat > /tmp/fu.c > int main(void){ > int x; > > x =3D 1 % 0; > } > /tmp/fu.c: In function `main': > /tmp/fu.c:4: warning: division by zero > > - erik > > > Dan Cross writes > > | > | On Thu, Dec 15, 2005 at 11:51:15PM -0500, Dan Cross wrote: > | > On Thu, Dec 15, 2005 at 08:04:02PM -0800, Jack Johnson wrote: > | > > So, what *is* -5 MOD 3? > | > > | > Well, in general, it depends. > | > > | > Do you care whether the result a set or an integer? The definitions = due > | > to Wirth et al are the former, while the MS definition appears to be = the > | > latter. > | > | Hmm, I guess on further reflection I ought to explain what I mean by > | this before someone jumps all over me. > | > | The definition as per Wirth et al gives you a positive generator for an > | equivalence class on Z, whereas the microsoft definition gives you the > | definition of the division function extended to all of Z, which yields > | an integer; the former definition is probably more comfortable for a > | mathematician, and more what one would expect. The latter is more > | comfortable for someone who just wants to write a program. In neither > | case does this have much to do with the actual implementation (that is > | to say, it's not like DIV actually gives you back an object > | representing the set of all integers congruent to 0 modulo some integer > | in Pascal), but only how that language interprets the definitions. > | > | > Regardless, all these definitions are problematic. No where does it = say > | > they're defined only on Z*; what if Y is 0? > | > | This is still a problem. You really want a function f: Z x Z* -> Z, > | not f: Z x Z -> Z; that is, for f(x, y) =3D x div y, y should be non-ze= ro. > | Otherwise, it would be an absurdity. > | > | - Dan C. >