Skip to main content

Module bignum

Module bignum 

Source
🔬This is a nightly-only experimental API. (core_private_bignum)
Expand description

Custom arbitrary-precision number (bignum) implementation.

This is designed to avoid the heap allocation at expense of stack memory. The most used bignum type, Big32x40 and Big64x20 you can choose, is limited by 32 × 40 = 1,280 bits and will take at most 160 bytes of stack memory. This is more than enough for round-tripping all possible finite f64 values.

In principle it is possible to have multiple bignum types for different inputs, but we don’t do so to avoid the code bloat. Each bignum is still tracked for the actual usages, so it normally doesn’t matter.

Modules§

tests 👻 Experimental

Macros§

define_bignum 🔒 Experimental
impl_full_ops 🔒 Experimental

Structs§

Big64x20Experimental
Stack-allocated arbitrary-precision (up to certain limit) integer.

Constants§

SMALL_POW5 🔒 Experimental
Table of powers of 5 representable in digits. Specifically, the largest {u8, u16, u32, u64} value that’s a power of five, plus the corresponding exponent. Used in mul_pow5.

Traits§

FullOpsExperimental
Arithmetic operations required by bignums.

Type Aliases§

BigExperimental
DigitExperimental
Digit32Experimental
the digit type for Big32x40
Digit64Experimental
The digit type for Big64x20.