f32.abs
Pops a f32 value off the stack, works out the absolute value, and then pushes the result back on to the stack. If the value is positive then that is the value pushed onto the stack. If the value is negative then it is changed into a positive one, for example, -3.142 become 3.142, and 2.718 stays as 2.718 (because it is already positive).

Syntax

f32.abs

Stack In

f32 The value to make absolute.

Stack Out

f32 The absolute value of the value given. This is always the positive version of the value.

Examples

;; Push the f32 value 3.142 onto the stack
f32.const 3.142

;; Pop the f32 value off the stack, workout the absolute value and
;; push the result back onto the stack
f32.abs

;; The stack contains an f32 value of 3.142
;; Push the f32 value -2.718 onto the stack
f32.const -2.718

;; Pop the f32 value off the stack, workout the absolute value and
;; push the result back onto the stack
f32.abs

;; The stack contains an f32 value of 2.718