f32 Instructions
f32.convert_i32_s
Section titled “f32.convert_i32_s”Convert signed i32 to f32.
Signature: (param i32) (result f32)
Example:
(f32.convert_i32_s (i32.const -5)) ;; Returns -5.0f32.convert_i32_u
Section titled “f32.convert_i32_u”Convert unsigned i32 to f32.
Signature: (param i32) (result f32)
Example:
(f32.convert_i32_u (i32.const 5)) ;; Returns 5.0f32.convert_i64_s
Section titled “f32.convert_i64_s”Convert signed i64 to f32.
Signature: (param i64) (result f32)
Example:
(f32.convert_i64_s (i64.const -5)) ;; Returns -5.0f32.convert_i64_u
Section titled “f32.convert_i64_u”Convert unsigned i64 to f32.
Signature: (param i64) (result f32)
Example:
(f32.convert_i64_u (i64.const 5)) ;; Returns 5.0f32.demote_f64
Section titled “f32.demote_f64”Convert f64 to f32 (may lose precision).
Signature: (param f64) (result f32)
Example:
(f32.demote_f64 (f64.const 3.141592653589793)) ;; Returns ~3.1415927f32.reinterpret_i32
Section titled “f32.reinterpret_i32”Reinterpret i32 bits as f32.
Signature: (param i32) (result f32)
Example:
(f32.reinterpret_i32 (i32.const 0x3F800000)) ;; Returns 1.0f32.add
Section titled “f32.add”Add two f32 values.
Signature: (param f32 f32) (result f32)
Example:
(f32.add (f32.const 3.14) (f32.const 2.86))f32.sub
Section titled “f32.sub”Subtract two f32 values.
Signature: (param f32 f32) (result f32)
Example:
(f32.sub (f32.const 10.5) (f32.const 3.2))f32.mul
Section titled “f32.mul”Multiply two f32 values.
Signature: (param f32 f32) (result f32)
Example:
(f32.mul (f32.const 3.5) (f32.const 2.0))f32.div
Section titled “f32.div”Divide two f32 values.
Signature: (param f32 f32) (result f32)
Example:
(f32.div (f32.const 10.0) (f32.const 3.0))f32.sqrt
Section titled “f32.sqrt”Calculate square root.
Signature: (param f32) (result f32)
Example:
(f32.sqrt (f32.const 16.0)) ;; Returns 4.0f32.min
Section titled “f32.min”Return minimum of two f32 values.
Signature: (param f32 f32) (result f32)
Example:
(f32.min (f32.const 3.5) (f32.const 2.1)) ;; Returns 2.1f32.max
Section titled “f32.max”Return maximum of two f32 values.
Signature: (param f32 f32) (result f32)
Example:
(f32.max (f32.const 3.5) (f32.const 2.1)) ;; Returns 3.5f32.abs
Section titled “f32.abs”Absolute value.
Signature: (param f32) (result f32)
Example:
(f32.abs (f32.const -3.14)) ;; Returns 3.14f32.neg
Section titled “f32.neg”Negate value.
Signature: (param f32) (result f32)
Example:
(f32.neg (f32.const 3.14)) ;; Returns -3.14f32.ceil
Section titled “f32.ceil”Round up to nearest integer.
Signature: (param f32) (result f32)
Example:
(f32.ceil (f32.const 3.2)) ;; Returns 4.0f32.floor
Section titled “f32.floor”Round down to nearest integer.
Signature: (param f32) (result f32)
Example:
(f32.floor (f32.const 3.8)) ;; Returns 3.0f32.trunc
Section titled “f32.trunc”Round toward zero.
Signature: (param f32) (result f32)
Example:
(f32.trunc (f32.const 3.8)) ;; Returns 3.0(f32.trunc (f32.const -3.8)) ;; Returns -3.0f32.nearest
Section titled “f32.nearest”Round to nearest integer, ties to even.
Signature: (param f32) (result f32)
Example:
(f32.nearest (f32.const 3.5)) ;; Returns 4.0(f32.nearest (f32.const 2.5)) ;; Returns 2.0 (ties to even)f32.copysign
Section titled “f32.copysign”Copy sign of second argument to first argument.
Signature: (param f32 f32) (result f32)
Example:
(f32.copysign (f32.const 5.0) (f32.const -1.0)) ;; Returns -5.0f32.eq
Section titled “f32.eq”Check if two f32 values are equal.
Signature: (param f32 f32) (result i32)
Example:
(f32.eq (f32.const 3.14) (f32.const 3.14)) ;; Returns 1 (true)f32.ne
Section titled “f32.ne”Check if two f32 values are not equal.
Signature: (param f32 f32) (result i32)
Example:
(f32.ne (f32.const 3.14) (f32.const 2.71)) ;; Returns 1 (true)f32.lt
Section titled “f32.lt”Check if first f32 is less than second.
Signature: (param f32 f32) (result i32)
Example:
(f32.lt (f32.const 2.0) (f32.const 3.0)) ;; Returns 1 (true)f32.gt
Section titled “f32.gt”Check if first f32 is greater than second.
Signature: (param f32 f32) (result i32)
Example:
(f32.gt (f32.const 3.0) (f32.const 2.0)) ;; Returns 1 (true)f32.le
Section titled “f32.le”Check if first f32 is less than or equal to second.
Signature: (param f32 f32) (result i32)
Example:
(f32.le (f32.const 3.0) (f32.const 3.0)) ;; Returns 1 (true)f32.ge
Section titled “f32.ge”Check if first f32 is greater than or equal to second.
Signature: (param f32 f32) (result i32)
Example:
(f32.ge (f32.const 3.0) (f32.const 3.0)) ;; Returns 1 (true)f32.load
Section titled “f32.load”Load f32 from memory at the given address.
Signature: (param i32) (result f32)
Example:
(f32.load (i32.const 0))(f32.load offset=4 align=4 (i32.const 0))f32.store
Section titled “f32.store”Store f32 value to memory.
Signature: (param i32 f32)
Example:
(f32.store (i32.const 0) (f32.const 3.14))f32.const
Section titled “f32.const”Create a constant f32 value.
Signature: (result f32)
Example:
(f32.const 3.14159)(f32.const -0.0)(f32.const inf)(f32.const nan)