Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!emory!att!att!ima!dirtydog!karl From: karl@ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: % operator with negatives Message-ID: <1990Dec14.064305.4491@dirtydog.ima.isc.com> Date: 14 Dec 90 06:43:05 GMT References: <1990Dec12.185714.7169@mp.cs.niu.edu> <1990Dec12.205416.26622@zoo.toronto.edu> <7461:Dec1310:04:0990@kramden.acf.nyu.edu> <18140@neptune.inf.ethz.ch> Sender: news@dirtydog.ima.isc.com (NEWS ADMIN) Reply-To: karl@ima.isc.com (Karl Heuer) Organization: Interactive Systems Lines: 15 In article <18140@neptune.inf.ethz.ch> brandis@inf.ethz.ch (Marc Brandis) writes: >Did somebody ever try it on the VAX? A guy told me once that integer division >rounds toward zero on the VAX while the MOD instruction delivers always a >positive result... Sounds like you're refering to what the Pascal compiler does, rather than the machine language. When I first encountered the VAX, one of my first complaints was that it didn't *have* a 32-bit MOD instruction (or equivalently, a DIV that generated remainder as well as quotient). The compiler must either generate a-(a/b)*b, or extend a into a double word% and use the 64-bit EDIV (which *does* generate both quotient and remainder). Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint % DEC, out of loyalty to their 16-bit line, called their halfwords `words' and so they called this thing a `quadword'.