slovo/tests/f64-numeric-primitive.surface.lower
2026-05-22 08:38:43 +02:00

51 lines
1011 B
Plaintext

program main
fn half(value: f64) -> f64
binary /
var value
float 2
fn weighted(base: f64, scale: f64) -> f64
binary +
var base
binary *
var scale
float 2.5
fn local_total() -> f64
local let subtotal: f64
call weighted
float 4
float 3
binary -
var subtotal
float 1.5
fn close_enough(value: f64) -> bool
if
binary >
var value
float 9
binary <
var value
float 11
bool false
fn exact_literal() -> bool
binary =
call half
float 7
float 3.5
fn main() -> i32
call std.io.print_f64
call local_total
if
call close_enough
call local_total
int 0
int 1
test "f64 arithmetic returns exact fixture value"
binary =
call local_total
float 10
test "f64 comparison works in predicates"
call close_enough
call local_total
test "f64 division and equality"
call exact_literal