f32.trunc
Pops a f32 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 f32.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

f32.trunc

Stack In

f32 The value to get truncated.

Stack Out

f32 The truncated value of the value given.

Examples

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

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

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

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

;; The stack contains an f32 value of -12.00