Crate ibig[][src]

Big integer library.

The library implements arbitrarily large integer arithmetic in pure Rust.

The two integer types are UBig (for unsigned integers) and IBig (for signed integers).

use ibig::prelude::*;

let a = ubig!(12345678);
let b = ubig!(0x10ff);
let c = ibig!(-azz base 36);
let d: UBig = "15033211231241234523452345345787".parse()?;

assert_eq!(c.to_string(), "-14255");
assert_eq!(
    (a * b.pow(10)).to_str_radix(16),
    "1589bda8effbfc495d8d73c83d8b27f94954e"
);
assert_eq!(
    format!("hello {:#x}", d % ubig!(0xabcd1234134132451345)),
    "hello 0x1a7e7c487267d2658a93"
);

Modules

prelude

Reexports the most useful names.

Macros

ibig

Create an IBig value.

ubig

Create a UBig value.

Structs

IBig

Signed big integer.

InRadix

Representation of a UBig or IBig in any radix between 2 and 36 inclusive.

OutOfBoundsError

Number out of bounds.

UBig

Unsigned big integer.

UniformIBig

Uniform IBig distribution.

UniformUBig

Uniform UBig distribution.

Enums

ParseError

Parse error when parsing UBig or IBig.

Traits

Abs

Absolute value.

AndNot

Bitwise AND NOT operation.

DivEuclid

Compute Euclidean quotient.

DivRem

Compute quotient and remainder at the same time.

DivRemEuclid

Compute Euclidean quotient and remainder at the same time.

NextPowerOfTwo

Next power of two.

RemEuclid

Compute Euclidean remainder.

UnsignedAbs

Unsigned absolute value.