41 lines
975 B
Plaintext
41 lines
975 B
Plaintext
(module main)
|
|
|
|
(fn f64_zero_text () -> string
|
|
(std.num.f64_to_string (- 2.5 2.5)))
|
|
|
|
(fn f64_fractional_text () -> string
|
|
(std.num.f64_to_string (/ 7.0 2.0)))
|
|
|
|
(fn f64_negative_text () -> string
|
|
(std.num.f64_to_string (- 2.5 4.0)))
|
|
|
|
(fn f64_whole_text () -> string
|
|
(std.num.f64_to_string (+ 7.0 3.0)))
|
|
|
|
(test "f64 zero to string"
|
|
(= (f64_zero_text) "0.0"))
|
|
|
|
(test "f64 fractional to string"
|
|
(= (f64_fractional_text) "3.5"))
|
|
|
|
(test "f64 negative to string"
|
|
(= (f64_negative_text) "-1.5"))
|
|
|
|
(test "f64 whole to string"
|
|
(= (f64_whole_text) "10.0"))
|
|
|
|
(test "f64 negative string length"
|
|
(= (std.string.len (f64_negative_text)) 4))
|
|
|
|
(test "f64 whole string length"
|
|
(= (std.string.len (f64_whole_text)) 4))
|
|
|
|
(fn main () -> i32
|
|
(std.io.print_string (f64_zero_text))
|
|
(std.io.print_string (f64_fractional_text))
|
|
(std.io.print_string (f64_negative_text))
|
|
(std.io.print_string (f64_whole_text))
|
|
(if (= (std.string.len (f64_fractional_text)) 3)
|
|
0
|
|
1))
|