Sign conventions for remainder
From: Michael Stemper (mstemper_at_siemens-emis.com)
Date: 06/17/04
- Next message: Lynn Kurtz: "Re: A good Q???"
- Previous message: Stephen J. Herschkorn: "Re: f is continuous at the point a. Is f defined omkring a?"
- Next in thread: Keith A. Lewis: "Re: Sign conventions for remainder"
- Reply: Keith A. Lewis: "Re: Sign conventions for remainder"
- Reply: David Eppstein: "Re: Sign conventions for remainder"
- Reply: Gerry Myerson: "Re: Sign conventions for remainder"
- Reply: mike.staniforth: "Re: Sign conventions for remainder"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Jun 2004 12:32:27 -0500
Just for fun, I've been implementing a package to perform arithmetic on
integers of arbitrary size. Addition, subtraction, and multiplication
were all pretty straight-forward. (Subtraction was the easiest!) But,
when I prepared to implement division, I realized that I'm not aware of
the conventions for remainders.
If the divisor and the dividend are both positive, I know that my result
should be d = n*q+r, with 0<=r<n. What if one of them is negative? Should
the remainder still be in that range? Should it be in the negative of that
range? What about if both the divisor and the dividend are negative?
Yes, I am aware that there is no "right" answer to this, there are only
conventions. But, that's exactly what I'm looking for. Conventions are
usually established because they're useful.
-- Michael F. Stemper #include <Standard_Disclaimer> Reunite Gondwanaland!
- Next message: Lynn Kurtz: "Re: A good Q???"
- Previous message: Stephen J. Herschkorn: "Re: f is continuous at the point a. Is f defined omkring a?"
- Next in thread: Keith A. Lewis: "Re: Sign conventions for remainder"
- Reply: Keith A. Lewis: "Re: Sign conventions for remainder"
- Reply: David Eppstein: "Re: Sign conventions for remainder"
- Reply: Gerry Myerson: "Re: Sign conventions for remainder"
- Reply: mike.staniforth: "Re: Sign conventions for remainder"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|