Expand description
Lean’s Nat: a natural number of any size.
A number that fits in a word minus one bit is stored in the pointer bits; anything larger
is a heap object holding limbs. Every function keeps that invariant, so equal numbers have
equal representations. As in lean.h, arguments are borrowed and results are owned,
except for the _mk conversions, which consume their argument.
Constants§
- MAX_
SMALL - The largest number stored in the pointer bits.
Functions§
- cstr_
to_ nat - A literal too large for
unsigned_to_nat, from its decimal digits. - float_
of_ ⚠nat - The nearest
f64. - int8_
of_ ⚠nat - int16_
of_ ⚠nat - int32_
of_ ⚠nat - int64_
of_ ⚠nat - isize_
of_ ⚠nat - nat_add⚠
- nat_
dec_ ⚠eq - nat_
dec_ ⚠le - nat_
dec_ ⚠lt - nat_div⚠
- Division rounding down; zero when the divisor is zero.
- nat_
div_ ⚠exact - Division of a number by one of its divisors.
- nat_gcd⚠
- nat_
land ⚠ - nat_
log2 ⚠ - The position of the highest set bit; zero for zero.
- nat_lor⚠
- nat_
lxor ⚠ - nat_mod⚠
- Remainder; the dividend when the divisor is zero.
- nat_mul⚠
- nat_pow⚠
- nat_
powmod ⚠ - nat_
pred ⚠ - nat_
shiftl ⚠ - nat_
shiftr ⚠ - nat_sub⚠
- Truncated subtraction: zero when
bis larger. - nat_
succ ⚠ - of_u128
- ordering⚠
- to_
decimal ⚠ - The decimal digits of a number.
- to_u128⚠
- The number as a
u128, if it fits. - uint8_
of_ ⚠nat - The number modulo the width of the result.
- uint8_
of_ ⚠nat_ mk - Like the function without
_mk, but consumes the argument. - uint8_
to_ nat - uint16_
of_ ⚠nat - The number modulo the width of the result.
- uint16_
of_ ⚠nat_ mk - Like the function without
_mk, but consumes the argument. - uint16_
to_ nat - uint32_
of_ ⚠nat - The number modulo the width of the result.
- uint32_
of_ ⚠nat_ mk - Like the function without
_mk, but consumes the argument. - uint32_
to_ nat - uint64_
of_ ⚠nat - The number modulo the width of the result.
- uint64_
of_ ⚠nat_ mk - Like the function without
_mk, but consumes the argument. - uint64_
to_ nat - unsigned_
to_ nat - usize_
of_ ⚠nat - The number modulo the width of the result.
- usize_
of_ ⚠nat_ mk - Like the function without
_mk, but consumes the argument. - usize_
to_ nat