/// Conversions of `Float` (ADR 0035). /// /// float.from_int(3) // 3.0 /// float.to_bits(1.0) // 4607182418800017408 /// float.from_bits32(0x3F800000) // 1.0 /// /// The bits are IEEE 754's, as an `Int` in `[0, 2^64)` (or `[0, 2^32)` for /// a single), so `-0.0` is `2^63`, a big integer. NaN payloads are kept. /// The nearest Float to `n` (ties to even); an infinity past the largest. @extern c "tl_float_from_int" pub fn from_int :: n: Int -> Float /// The 64 bits of a Float. @extern c "tl_float_to_bits" pub fn to_bits :: x: Float -> Int /// The Float whose bits are the low 64 bits of `n`. @extern c "tl_float_from_bits" pub fn from_bits :: n: Int -> Float /// `x` rounded to a 32-bit single (to nearest, ties to even), its bits. @extern c "tl_float_to_bits32" pub fn to_bits32 :: x: Float -> Int /// The single whose bits are the low 32 bits of `n`, as a Float (exact). @extern c "tl_float_from_bits32" pub fn from_bits32 :: n: Int -> Float /// The Float written in `s` (decimal, exponent allowed), or an `Error` /// naming the text that is not one. pub fn parse :: s: String -> Result { let (ok, f) = parse_raw s if ok { Ok(f) } else { Error("not a float: " <> debug s) } } @extern c "tl_float_parse" fn parse_raw :: s: String -> (Bool, Float)