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