f64.abs
Pops a f64 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

f64.abs

Stack In

f64 The value to make absolute.

Stack Out

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

Examples

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

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

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

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

;; The stack contains an f64 value of 2.718