Home / Docs / Specification / 29. Numerics

29.1 The type

Release v0.4.0
  1. F64 is a built-in type: an IEEE 754 binary64 value. Its values are every binary64 value that is not a NaN, and one NaN, the canonical NaN, whose bits are 0x7FF8000000000000 (positive, quiet, payload zero). There is no other NaN in the language (§6).
  2. Distinct. F64 is distinct from Int and from every fixed-width integer. An operator with an F64 and an integer operand is U2001, with a repair that converts the integer by to_f64() (§4).
  3. Refinements, type arguments and labels. F64 MAY be refined (kind Unit01 = F64 where it.ieee_ge(other: 0.0) and it <= 1.0). F64 is a legal type argument (List[F64], Map[F64, Text]) and carries labels as Int does (spec/07).
  4. Names. A user kind, variant, capability or unit named F64 is U1002.
  5. Constraints (spec/20 §1). F64 satisfies Eq and Ord (§5), and never Integer. So sort, min, max, contains and Map[F64, V] accept it, and sum does not: a sum of floats depends on its order, so a program writes it with fold, in the order it chooses.