slovo/lib/std/num.slo
2026-05-22 08:38:43 +02:00

56 lines
1.5 KiB
Plaintext

(module num (export i32_to_i64 i32_to_f64 i64_to_f64 i64_to_i32_result f64_to_i32_result f64_to_i64_result i32_to_string u32_to_string i64_to_string u64_to_string f64_to_string i64_to_i32_or f64_to_i32_or f64_to_i64_or))
(fn i32_to_i64 ((value i32)) -> i64
(std.num.i32_to_i64 value))
(fn i32_to_f64 ((value i32)) -> f64
(std.num.i32_to_f64 value))
(fn i64_to_f64 ((value i64)) -> f64
(std.num.i64_to_f64 value))
(fn i64_to_i32_result ((value i64)) -> (result i32 i32)
(std.num.i64_to_i32_result value))
(fn f64_to_i32_result ((value f64)) -> (result i32 i32)
(std.num.f64_to_i32_result value))
(fn f64_to_i64_result ((value f64)) -> (result i64 i32)
(std.num.f64_to_i64_result value))
(fn i32_to_string ((value i32)) -> string
(std.num.i32_to_string value))
(fn u32_to_string ((value u32)) -> string
(std.num.u32_to_string value))
(fn i64_to_string ((value i64)) -> string
(std.num.i64_to_string value))
(fn u64_to_string ((value u64)) -> string
(std.num.u64_to_string value))
(fn f64_to_string ((value f64)) -> string
(std.num.f64_to_string value))
(fn i64_to_i32_or ((value i64) (fallback i32)) -> i32
(match (i64_to_i32_result value)
((ok payload)
payload)
((err code)
fallback)))
(fn f64_to_i32_or ((value f64) (fallback i32)) -> i32
(match (f64_to_i32_result value)
((ok payload)
payload)
((err code)
fallback)))
(fn f64_to_i64_or ((value f64) (fallback i64)) -> i64
(match (f64_to_i64_result value)
((ok payload)
payload)
((err code)
fallback)))