(module main)

(fn half ((value f64)) -> f64
  (/ value 2.0))

(fn weighted ((base f64) (scale f64)) -> f64
  (+ base (* scale 2.5)))

(fn local_total () -> f64
  (let subtotal f64 (weighted 4.0 3.0))
  (- subtotal 1.5))

(fn close_enough ((value f64)) -> bool
  (if (> value 9.0)
    (< value 11.0)
    false))

(fn exact_literal () -> bool
  (= (half 7.0) 3.5))

(fn main () -> i32
  (std.io.print_f64 (local_total))
  (if (close_enough (local_total)) 0 1))

(test "f64 arithmetic returns exact fixture value"
  (= (local_total) 10.0))

(test "f64 comparison works in predicates"
  (close_enough (local_total)))

(test "f64 division and equality"
  (exact_literal))
