Title
numeric_limits::is_modulo insufficiently defined
Status
cd1
Section
[numeric.limits.members]
Submitter
Chris Jefferson

Created on 2006-11-10.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Suggest [numeric.limits.members], paragraph 57 is amended to:

A type is modulo if, it is possible to add two positive numbers and have a result that wraps around to a third number that is less. given any operation involving +,- or * on values of that type whose value would fall outside the range [min(), max()], then the value returned differs from the true value by an integer multiple of (max() - min() + 1).

Date: 2010-10-21.18:28:33

[ Bellevue: accept resolution, move to ready status. Does this mandate that is_modulo be true on platforms for which int happens to b modulo? A: the standard already seems to require that. ]

Date: 2010-10-21.18:28:33

[ Batavia: Related to N2144. Pete: is there an ISO definition of modulo? Underflow on signed behavior is undefined. ]

Date: 2006-11-10.00:00:00

18.2.1.2 55 states that "A type is modulo if it is possible to add two positive numbers together and have a result that wraps around to a third number that is less". This seems insufficient for the following reasons:

  1. Doesn't define what that value received is.
  2. Doesn't state the result is repeatable
  3. Doesn't require that doing addition, subtraction and other operations on all values is defined behaviour.
History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3214
2010-10-21 18:28:33adminsetmessages: + msg3213
2010-10-21 18:28:33adminsetmessages: + msg3212
2006-11-10 00:00:00admincreate