Related articles |
---|
Constant divisions, remainders rutt@paradise.mti.sgi.com (1992-10-20) |
Re: Constant divisions, remainders Cheryl_Lins@gateway.qm.apple.com (Cheryl Lins) (1992-10-21) |
Re: Constant divisions, remainders phillips@swanee.ee.uwa.oz.au (1992-10-23) |
Re: Constant divisions, remainders kelsey@flora.ccs.northeastern.edu (1992-10-27) |
Re: Constant divisions, remainders torbenm@diku.dk (1992-11-02) |
Re: Constant divisions, remainders joe@babel.ho.att.com (1992-11-05) |
Re: Constant divisions, remainders henry@zoo.toronto.edu (1992-11-08) |
Re: Constant divisions, remainders jones@pyrite.cs.uiowa.edu (1992-11-11) |
Re: Constant divisions, remainders nickh@CS.CMU.EDU (1992-11-11) |
Re: Constant divisions, remainders preston@miranda.cs.rice.edu (1992-11-11) |
The definition of division drw@euclid.mit.edu (1992-11-11) |
Re: Constant divisions, remainders jlg@cochiti.lanl.gov (1992-11-12) |
[2 later articles] |
Newsgroups: | comp.compilers |
From: | joe@babel.ho.att.com (Joseph M Orost) |
Organization: | Echo Logic |
Date: | Thu, 5 Nov 1992 13:16:46 GMT |
References: | 92-10-075 92-11-006 |
Keywords: | arithmetic |
kelsey@flora.ccs.northeastern.edu writes:
[Right shift isn't the same as division when the dividend is negative.]
torbenm@diku.dk (Torben AEgidius Mogensen) writes:
>This depends on how you define div and mod for negative integers. The most
>usually found "definition" is that div rounds towards 0, and that mod is
>signed. But most mathematicians prefer to make div always round down and
>that mod is nonnegative. ...
>
>I think the round-to-zero rule for div and signed mod are relics from ones
>complement computers, and should be laid to rest.
The problem with this thinking is that you will get inconsistent results
if you divide by a constant power-of-2 versus dividing by a variable with
the same value. And you will get LOTS of bug reports from the compiler
users!
In order to have the round-to-zero rule "laid to rest," first you have to
convince all the hardware designers out there that their DIV instruction
is broken: GOOD LUCK!
regards,
joe
--
Full Name: Joseph M. Orost
EMail: joe@babel.ho.att.com
Organization: Echo Logic
SurfaceMail: 943 Holmdel Rd.; Cruz Plaza; Holmdel, NJ 07733
Phone: +1 (908) 946-1115
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.