From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-05-27 17:05:27
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 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk