This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: MMIX-related changes, committed.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]