Expand description
Arbitrary-precision integer arithmetic for the OxiNum ecosystem.
Provides BigInt and BigUint type aliases over dashu-int’s IBig/UBig,
plus number-theory functions: factorial, fibonacci, binomial coefficients,
modular exponentiation, primality testing, and extended GCD.
Modules§
- native
- Native arbitrary-precision integer types implemented in pure Rust.
Structs§
Enums§
- OxiNum
Error - Errors from OxiNum operations.
- Sign
- An enum representing the sign of a number
Traits§
- Gcd
- Compute the greatest common divisor.
Functions§
- binomial
- Computes the binomial coefficient
C(n, k) = n! / (k! * (n-k)!). - extended_
gcd - Computes the extended GCD of
aandb, returning(gcd, x, y)such thata * x + b * y = gcd. - factorial
- Computes
n!(factorial ofn). - fibonacci
- Computes the
n-th Fibonacci number using the fast-doubling method. - ibig_
abs - Returns the absolute value of the
IBig. - ibig_
from_ radix - Parse an
IBigfromsrcin the givenradix(2..=36). - ibig_
is_ one - Returns
trueif theIBigis one. - ibig_
is_ zero - Returns
trueif theIBigis zero. - ibig_
signum - Returns the sign of the
IBig. - ibig_
to_ radix - Format an
IBigas a string in the givenradix(2..=36). - is_
prime - Tests whether
nis (probably) prime using the Miller-Rabin test. - lucas
- Computes the Lucas number
L(n)whereL(0) = 2, L(1) = 1. - mod_pow
- Computes
(base^exp) mod modulususing binary (right-to-left) exponentiation. - next_
prime - Returns the smallest prime greater than
n. - ubig_
from_ radix - Parse a
UBigfromsrcin the givenradix(2..=36). - ubig_
is_ one - Returns
trueif theUBigis one. - ubig_
is_ zero - Returns
trueif theUBigis zero. - ubig_
to_ radix - Format a
UBigas a string in the givenradix(2..=36).
Type Aliases§
- BigInt
- Type alias:
BigIntisdashu_int::IBig. - BigUint
- Type alias:
BigUintisdashu_int::UBig. - OxiNum
Result - Convenience alias for
Result<T, OxiNumError>.