Negation
The negation operator denotes the arithmetic negation of its operand.
Process
At runtime:
- the operand is evaluated; and
- its arithmetic negation is computed, and is the negation's value.
For signed integer types, negation is two's complement negation; negating the minimum value of a signed integer type wraps to itself. For floating-point types, negation follows IEEE 754 semantics.
Negative literal values are formed by applying this operator to a literal; see integer literals.
Assertions
- The operand's type is a signed integer type or a floating-point type, and the negation's result has that type.
- When an expected type exists, the operand's expected type is that type.
Syntax
negation_operator = minus ;