Unformatted version of **ai05s/ai05-0260-1.txt version 1.2**

Other versions for file**ai05s/ai05-0260-1.txt**

Other versions for file

!standard 4.5.5(8) 11-07-28 AI05-0260-1/02

!class binding interpretation 11-06-19

!status Amendment 2012 11-07-28

!status ARG Approved 11-1-0 11-06-26

!status work item 11-06-16

!status received 11-05-17

!priority Low

!difficulty Easy

!qualifier Error

!subject Pedantic question on the wording of the definition of modulo

!class binding interpretation 11-06-19

!status Amendment 2012 11-07-28

!status ARG Approved 11-1-0 11-06-26

!status work item 11-06-16

!status received 11-05-17

!priority Low

!difficulty Easy

!qualifier Error

!subject Pedantic question on the wording of the definition of modulo

!summary

Zero doesn't have a sign, so we need to except it from the wording.

!question

4.5.5(8) says:

The signed integer modulus operation is defined such that the result of A mod
B has the sign of B and an absolute value less than the absolute value of B;
in addition, for some signed integer value N, the result satisfies the
relation:

A = B*N + (A mod B)

If A := 0 and B < 0 then the only solution to the relation that has abs(A mod B)
< abs(B) is A mod B = 0. But 0 does not have the "sign of B" (it is not
negative). Should this be fixed? (Yes.)

!wording

Modify the start of 4.5.5(8):

The signed integer modulus operation is defined such that the result
of A mod B {is either zero, or} has the sign of B and an absolute
value less than the absolute value of B; in addition, ...

!discussion

!corrigendum 4.5.5(8)

Replace the paragraph:

The signed integer modulus operator is defined such that the result of A **mod** B has
the sign of B and an absolute value less than the absolute value of B; in addition,
for some signed integer value N, this result satisfies the relation:

by:

The signed integer modulus operator is defined such that the result of A **mod** B is
either zero or has the sign of B and an absolute value less than the absolute value
of B; in addition, for some signed integer value N, this result satisfies the
relation:

!ACATS Test

None needed.

!ASIS

No change needed.

!appendix

!topic Pedantic question on the wording of the definition of modulo !reference Ada 2005 RM !from Martin Brain 11-05-17 !keywords multiplicative operators, modulo, pendantry !discussion In the Ada 2005 LRM (ISO/IEC 8652:2007 Ed 3), Section 4.5.5 defines the modulo operator as: <quote> The signed integer modulus operation is defined such that the result of A mod B has the sign of B and an absolute value less than the absolute value of B; in addition, for some signed integer value N, the result satisfies the relation: A = B*N + (A mod B) </quote> If A := 0 and B < 0 then the only solution to the relation that has abs(A mod B) < abs(B) is A mod B = 0, which I believe to be the intended and expected result. However the sign of zero is not the same as the sign of a negative number, giving a contradiction. Although this is a point of pedantry, it would be nice if the wording of the definition was changed. **************************************************************** From: Adam Beneschan Sent: Tuesday, May 17, 2011 2:42 PM I think I'd change it to The signed integer modulus operation is defined such that the result of A mod B is either zero, or has the sign of B and an absolute value less than the absolute value of B; in addition, ... ****************************************************************

Questions? Ask the ACAA Technical Agent