Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 993 Bytes

iii.3.50-neg.md

File metadata and controls

25 lines (14 loc) · 993 Bytes

III.3.50 neg – negate

Format Assembly Format Description
65 neg Negate value.

Stack Transition:

…, value → …, result

Description:

The neg instruction negates value and pushes the result on top of the stack. The return type is the same as the operand type.

Negation of integral values is standard twos-complement negation. In particular, negating the most negative number (which does not have a positive counterpart) yields the most negative number. To detect this overflow use the sub.ovf instruction instead (i.e., subtract from 0).

Negating a floating-point number cannot overflow; negating NaN returns NaN. The acceptable operand types and their corresponding result data types are encapsulated in Table 3: Unary Numeric Operations.

Exceptions:

None.

Correctness and Verifiability:

See Table 3: Unary Numeric Operations.