
Beman Dawes wrote:
That isn't correct, AFAICT. An unsigned does support unary negation.
5.3/9 says "The operand of the unary - operator shall have arithmetic or enumeration type and the result is the negation of its operand. Integral promotion is performed on integral or enumeration operands. The negative of an unsigned quantity is computed by subtracting its value from 2n, where n is the number of bits in the promoted operand. The type of the result is
Perhaps we have to specify such an unsigned (modular) integer so that implementations can provide it. Such an unsigned_integer would then have a static method set_modulus( const integer & ). Then I should merge the unsigned_integer and modular_integer into unsigned_integer in the document. I will refer to [expr.unary.op] item in any case. "Sebastian Redl" <sebastian.redl@getdesigned.at> wrote in message news:4478BF17.7020404@getdesigned.at... the
type of the promoted operand."
The operator exists, but only for the language unsigned integers, which aren't really unsigned integers, but modulo integers, as is obvious from the definition of the negation. The same definition is impossible for a (theoretically) infinite-precision integer, because, lacking a number of bits in the representation (n), there is no 2^n from which can be subtracted.
Sebastian Redl _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost