f64.trunc
Pops a f64 value off the stack, truncates the value, and then pushes the result back on to the stack. This removes any decimal parts to leave only the whole number remaining. It is similar to the f64.floor instruction except it operates differently will negative numbers. For example, 1.23 becomes 1.0, and -1.23 becomes -1.0, unlike the floor instruction which would result in -2.0.

Syntax

f64.trunc

Stack In

f64 The value to get truncated.

Stack Out

f64 The truncated value of the value given.

Examples

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

;; Pop the f64 value off the stack, truncate the value and
;; push the result back onto the stack
f64.trunc

;; The stack contains an f64 value of 3.0
;; Push the f64 value -12.34 onto the stack
f64.const -12.34

;; Pop the f64 value off the stack, truncate the value and
;; push the result back onto the stack
f64.trunc

;; The stack contains an f64 value of -12.00