---
title: "29.4 Conversions"
url: https://una-lang.org/en/docs/spec/29-numerics/4-conversions/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/docs/spec/29-numerics.md
---

# 29.4 Conversions

1. **From integers.** `n.to_f64()` with no argument, on `Int` or a fixed-width integer, is IEEE `convertFromInt`: the nearest binary64 value, ties to even, decided on every bit of the integer. It is exact for every integer of magnitude at most 2^53. An `Int` of magnitude 2^1024 − 2^970 or more gives an infinity of its sign. It never fails, and it resolves ahead of a function of the same name.
2. **To integers.** `x.to_int_exact()` gives `Option[Int]`: `Some(n)` when `x` is finite and integral, with `n` its exact value (`-0.0` gives `Some(0)`), and `None` for NaN, an infinity and a value with a fraction. The rounding is the program's to write: `x.floor().to_int_exact()`. A fixed-width integer is reached through `Int`, by the conversions of `spec/18 §4`.
3. **No other conversion.** `x.to_int()` and `x.to_i64()` and the other integer conversions on an `F64` are U2001, with a repair to `to_int_exact()`.
