Negate
The neg
instructions, short for negate, are used to negate a number. That is, turn a positive number into a negative number and a negative number into a positive number.
Try it
Syntax
wasm
;; load a number onto the stack
f32.const 2.7
;; negate
f32.neg
;; the top item on the stack will now be -2.7
Instruction | Binary opcode |
---|---|
f32.neg |
0x8c |
f64.neg |
0x9a |