Crate big_int

source ·
Expand description

big_int - Arbitrary precision, arbitrary base integer arithmetic library.

use big_int::*;

let mut a: BigInt<10> = "9000000000000000000000000000000000000000".parse().unwrap();

a /= 13.into();
assert_eq!(a, "692307692307692307692307692307692307692".parse().unwrap());

let mut b: BigInt<16> = a.convert();
assert_eq!(b, "208D59C8D8669EDC306F76344EC4EC4EC".parse().unwrap());

b >>= 16.into();
let c: BigInt<2> = b.convert();
assert_eq!(c, "100000100011010101100111001000110110000110011010011110110111000011".parse().unwrap());

Structs

  • BigInt: represents an arbitrary-size integer in base BASE.

Enums

Constants

Traits

  • Safely retrieve items from a collection with negative indexing.
  • Safely retrieve a mutable reference from a collection with negative indexing.

Functions

Type Aliases

  • change these if you want to represent bases larger than 256
  • this must be twice the size of Digit (for overflow prevention)