15 lines
350 B
Plaintext
15 lines
350 B
Plaintext
(module
|
|
;; recursive, refactored to use s-expressions
|
|
(func $fact_f64 (export "fact_f64") (param f64) (result f64)
|
|
(if (result f64) (f64.lt (get_local 0) (f64.const 1))
|
|
(then f64.const 1)
|
|
(else
|
|
(f64.mul
|
|
(get_local 0)
|
|
(call $fact_f64 (f64.sub (get_local 0) (f64.const 1)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|