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