Re: Constant divisions, remainders

kelsey@flora.ccs.northeastern.edu
Tue, 27 Oct 1992 21:55:30 GMT

          From comp.compilers

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)
[3 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: kelsey@flora.ccs.northeastern.edu
Organization: Compilers Central
Date: Tue, 27 Oct 1992 21:55:30 GMT
References: 92-10-075
Keywords: arithmetic, comment

rutt@paradise.mti.sgi.com writes:
    I saw you post regarding constant multiplications on comp.compilers. I
    was curious as to whether you have any ideas about divisons and remainders
    by constants. ...


Just a reminder to all you compiler writers out there that in two's
complement


          X / 2**N == X >> N


is not always true if X < 0.
                                                                -Richard Kelsey
                                                                  kelsey@ccs.northeastern.edu
[Good point. In many cases the shift is still faster even with the extra
code to make negative answers round correctly. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.