Float agreement tests:
// Direct float arithmetic
check_both_float("2.0 + 3.0", 5.0);
check_both_float("6.0 * 7.0", 42.0);
check_both_float("22.0 / 7.0", 3.142857);
// Float variables
check_both_float("var x: f64 = 2.5; x * x", 6.25);
// Conversion
check_both_float("f64_from_i64(42)", 42.0);
check_both("i64_from_f64(3.7)", 3);
// Float in functions
check_both_float(
\\fn circle_area(r: f64) f64 {
\\ return r * r * 3.14159;
\\}
\\circle_area(5.0)
, 78.5397);
The function circle_area takes and returns f64. The compiler emits (func $circle_area (param $r f64) (result f64) -- real WAT float types. The VM executes float multiplication. Both engines agree.
### Practical example