Absolute
Die abs
Anweisungen, abgekürzt für absolute, werden verwendet, um den absoluten Wert einer Zahl zu erhalten. Das heißt, sie gibt x zurück, wenn x positiv ist, und die Negation von x, wenn x negativ ist.
Probieren Sie es aus
Syntax
wasm
;; load a number onto the stack
f32.const -2
;; absolute
f32.abs
;; the top item on the stack will now be 2
Anweisung | Binärer Opcode |
---|---|
f32.abs |
0x8b |
f64.abs |
0x99 |