Module core::fmt::num

source ·
Expand description

Integer and floating-point number formatting

Modules

Macros

Structs

  • Binary 🔒
    A binary (base 2) radix
  • LowerHex 🔒
    A hexadecimal (base 16) radix, formatted with lower-case characters
  • Octal 🔒
    An octal (base 8) radix
  • UpperHex 🔒
    A hexadecimal (base 16) radix, formatted with upper-case characters

Statics

Traits

Functions

  • exp_u128 🔒
  • fmt_u128 🔒
    Specialized optimization for u128. Instead of taking two items at a time, it splits into at most 2 u64s, and then chunks by 10e16, 10e8, 10e4, 10e2, and then 10e1. It also has to handle 1 last item, as 10^40 > 2^128 > 10^39, whereas 10^20 > 2^64 > 10^19.
  • Helper function for writing a u64 into buf going from last to first, with curr.
  • u128_mulhi 🔒
    Multiply unsigned 128 bit integers, return upper 128 bits of the result
  • udiv_1e19 🔒
    Partition of n into n > 1e19 and rem <= 1e19