Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!bionet!apple!bloom-beacon!tut.cis.ohio-state.edu!osu-cis!killer!texbell!bellcore!jcricket!sjs From: sjs@jcricket.ctt.bellcore.com (Stan Switzer) Newsgroups: comp.lang.c Subject: Re: DIV and MOD ( was: Something IBM did right ) Message-ID: <11608@bellcore.bellcore.com> Date: 8 Nov 88 14:48:15 GMT References: <11529@bellcore.bellcore.com> <972@goofy.megatest.UUCP> Sender: news@bellcore.bellcore.com Reply-To: sjs@ctt.bellcore.com (Stan Switzer) Organization: Bellcore Lines: 21 In article <972@goofy.megatest.UUCP> djones@megatest.UUCP (Dave Jones) writes: > As is Mr. Switzer, I too am absolutely certain that I know > how / and % should be defined for negative dividends. Peculiar > that we should not agree! :-) We agree on the MOD issue, but > not on DIV. Or maybe not. First he says that IBM "did it right": > > Please, do not argue that integer -1/2 should be -1... > But that is, or course, truncation toward a smaller value. > (-1 is smaller than -0.5) > Perhaps he will want to clarify. OOPS! I goofed. I meant 0 not -1. I agree completely with your followup. One day while I was hacking Postscript it occurred to me to see if Adobe was clever enough to do it right. After all, grapgics is one of the areas where it really matters how / and % work. I am sad to say that Postscript does it wrong too. And here it is impossible to blame the hardware, as the cost of making it work right would be insignificant compared to the interpreter overhead. Stan Switzer sjs@ctt.bellcore.com