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

64 lines
1.4 KiB
Plaintext

program main
fn f64_zero_text() -> string
call std.num.f64_to_string
binary -
float 2.5
float 2.5
fn f64_fractional_text() -> string
call std.num.f64_to_string
binary /
float 7
float 2
fn f64_negative_text() -> string
call std.num.f64_to_string
binary -
float 2.5
float 4
fn f64_whole_text() -> string
call std.num.f64_to_string
binary +
float 7
float 3
fn main() -> i32
call std.io.print_string
call f64_zero_text
call std.io.print_string
call f64_fractional_text
call std.io.print_string
call f64_negative_text
call std.io.print_string
call f64_whole_text
if
binary =
call std.string.len
call f64_fractional_text
int 3
int 0
int 1
test "f64 zero to string"
binary =
call f64_zero_text
string "0.0"
test "f64 fractional to string"
binary =
call f64_fractional_text
string "3.5"
test "f64 negative to string"
binary =
call f64_negative_text
string "-1.5"
test "f64 whole to string"
binary =
call f64_whole_text
string "10.0"
test "f64 negative string length"
binary =
call std.string.len
call f64_negative_text
int 4
test "f64 whole string length"
binary =
call std.string.len
call f64_whole_text
int 4