Wasm Reference
  • Welcome
  • Nodejs WAT Compiler
  • Types
    • Functions
    • Globals
    • Linear Memory
    • Tables
    • Numbers
    • Text
  • Structures
    • IF
    • LOOP
  • Algorithms
    • Hello World
    • Estimate Pi
  • Maths Helper Algorithms
    • Pseudorandom Number Generator
    • Factorial
    • Dist
    • Map
    • Fract
    • RemF or ModF
    • Round
    • Clamp
    • Mix
    • Pow
    • Approx Sin
    • Approx Cos
    • Approx Tan
    • ToRad and ToDeg
Powered by GitBook
On this page

Was this helpful?

  1. Maths Helper Algorithms

Mix

Interpolate between x and y using a.

(module
  (func $mix (export "mix") (param $x f32) (param $y f32) (param $a f32) (result f32)
    (f32.add
      (f32.mul 
        (get_local $x) 
        (f32.sub 
          (f32.const 1)
          (get_local $a)
        )
      )
      (f32.mul 
        (get_local $y)
        (get_local $a)
      )
    )
  )
)
PreviousClampNextPow

Last updated 5 years ago

Was this helpful?