This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: MMIX-related changes, committed.
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Subject: Re: MMIX-related changes, committed.
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Sat, 3 Nov 2001 23:56:39 +0000 (GMT)
- cc: <gcc-patches at gcc dot gnu dot org>
On Sat, 3 Nov 2001, Hans-Peter Nilsson wrote:
> <<
> 5 The result of the / operator is the quotient from the division
> of the first operand by the second; the result of the % operator
> is the remainder. In both operations, if the value of the
> second operand is zero, the behavior is undefined.
>
> 6 When integers are divided, the result of the / operator is the
> algebraic quotient with any fractional part discarded[87]. If
> the quotient a/b is representable, the expression (a/b)*b + a%b
> shall equal a.
>
> [87] This is often called "truncation toward zero".
> >>
>
> Does this say what you said? I don't think so, but I'm not
> sure. Please help interpreting.
It says that
a b a/b a%b
7 3 2 1
-7 3 -2 -1
7 -3 -2 1
-7 -3 2 -1
(which table is also to be found in the Rationale).
--
Joseph S. Myers
jsm28@cam.ac.uk