i64.trunc_sat_f64_u
Pops a f64 value off the stack, converts it into an i64 value, and then pushes it back on to the stack. This looks at the i64 value as an unsigned integer (positive value only). Any decimal parts of the number will be lost. The value must exist within the range 0 to 18446744073709551615 (2^64). If the value is outside this range then, instead of throwning a runtime error, it sets the resulting value to the upper or lower limit.

Syntax

i64.trunc_sat_f64_u

Stack In

f64 The value to be converted.

Stack Out

i64 The i64 version of the f64 value.

Examples

;; Convert f64 1234.567 into an i64 value
f64.const 1234.567
i64.trunc_sat_f64_u

;; The stack contains an i64 value of 1234
;; Convert f64 2200000000 into an i64 value
f64.const 2200000000
i64.trunc_sat_f64_u

;; The stack contains an i64 value of 2200000000
;; Convert f64 -3.142 into an i64 value
f64.const -3.142
i64.trunc_sat_f64_u

;; The stack contains an i64 value of 0 (lower limit)
;; Convert f64 20000000000000000000 into an i64 value
f64.const 20000000000000000000
i64.trunc_sat_f64_u

;; The stack contains an i64 value of 18446744073709551615 (upper limit)