Section: 17.3.5.2 [numeric.limits.members] Status: CD1 Submitter: Chris Jefferson Opened: 2006-11-10 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [numeric.limits.members].
View all issues with CD1 status.
Discussion:
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:
[ Batavia: Related to N2144. Pete: is there an ISO definition of modulo? Underflow on signed behavior is undefined. ]
[ 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. ]
Proposed resolution:
Suggest 17.3.5.2 [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)
.