Related articles |
---|
[12 earlier articles] |
Re: Q: division vs multiplication kptben@aol.com (1995-04-17) |
Re: Q: division vs multiplication pcg@aber.ac.uk (1995-04-17) |
Re: Q: division vs multiplication gsc@magna.com.au (1995-04-18) |
Re: Q: division vs multiplication jbuck@Synopsys.COM (1995-04-28) |
Re: Q: division vs multiplication davidm@flora.Rational.com (1995-04-28) |
Re: Q: division vs multiplication Roger@natron.demon.co.uk (Roger Barnett) (1995-04-28) |
Re: Q: division vs multiplication jmccarty@spdmail.spd.dsccc.com (1995-04-29) |
Newsgroups: | comp.compilers |
From: | jmccarty@spdmail.spd.dsccc.com (Mike McCarty) |
Keywords: | arithmetic, optimize |
Organization: | DSC Communications Corporation, Plano, Texas USA |
References: | 95-04-080 95-04-135 |
Date: | Sat, 29 Apr 1995 04:47:08 GMT |
<gsc@magna.com.au> wrote:
)martens@cis.ohio-state.edu (Jeff Martens) writes:
)The problem here is that -1 divided by 2 should give -1, with a remainder
)of +1. Unfortunately, it's hard to find hardware that does this right.
By whose definition? I am a mathematician, and I like that definition,
because it makes proving theorems easy. But there are other definitions
which are equally valid. Im some cases, it makes more sense (even to
mathematicians) to have the remainders be negative.
The real problem is, there is no -definitely- best way to define the
quotient and remainder when one or both are negative.
What should (-3)/(-2) be (quotient and remainder)? The answer is, it
depends. It was nice of the ANSI committee to specify the behavior of
div() and ldiv() so we could at least -depend- on the answer being
definite.
Mike
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.