|[12 earlier articles]|
|Re: Q: division vs multiplication email@example.com (1995-04-17)|
|Re: Q: division vs multiplication firstname.lastname@example.org (1995-04-17)|
|Re: Q: division vs multiplication email@example.com (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 firstname.lastname@example.org (1995-04-29)|
|From:||email@example.com (Mike McCarty)|
|Organization:||DSC Communications Corporation, Plano, Texas USA|
|Date:||Sat, 29 Apr 1995 04:47:08 GMT|
)firstname.lastname@example.org (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
Return to the
Search the comp.compilers archives again.