• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..30-Mar-2022-

benches/H30-Mar-2022-821625

ci/H30-Mar-2022-5332

src/H30-Mar-2022-8,0426,060

tests/H30-Mar-2022-4,7414,140

.cargo-checksum.jsonH A D03-May-202289 11

Cargo.tomlH A D30-Mar-20221.9 KiB8269

LICENSE-APACHEH A D30-Mar-202210.6 KiB202169

LICENSE-MITH A D30-Mar-20221 KiB2622

README.mdH A D30-Mar-20222.5 KiB7754

RELEASES.mdH A D30-Mar-20226.8 KiB167119

bors.tomlH A D30-Mar-202256 43

build.rsH A D30-Mar-2022312 1511

README.md

1# num-bigint
2
3[![crate](https://img.shields.io/crates/v/num-bigint.svg)](https://crates.io/crates/num-bigint)
4[![documentation](https://docs.rs/num-bigint/badge.svg)](https://docs.rs/num-bigint)
5![minimum rustc 1.15](https://img.shields.io/badge/rustc-1.15+-red.svg)
6[![Travis status](https://travis-ci.org/rust-num/num-bigint.svg?branch=master)](https://travis-ci.org/rust-num/num-bigint)
7
8Big integer types for Rust, `BigInt` and `BigUint`.
9
10## Usage
11
12Add this to your `Cargo.toml`:
13
14```toml
15[dependencies]
16num-bigint = "0.2"
17```
18
19and this to your crate root:
20
21```rust
22extern crate num_bigint;
23```
24
25## Features
26
27The `std` crate feature is mandatory and enabled by default.  If you depend on
28`num-bigint` with `default-features = false`, you must manually enable the
29`std` feature yourself.  In the future, we hope to support `#![no_std]` with
30the `alloc` crate when `std` is not enabled.
31
32Implementations for `i128` and `u128` are only available with Rust 1.26 and
33later.  The build script automatically detects this, but you can make it
34mandatory by enabling the `i128` crate feature.
35
36### Random Generation
37
38`num-bigint` supports the generation of random big integers when the `rand`
39feature is enabled. To enable it include rand as
40
41```toml
42rand = "0.5"
43num-bigint = { version = "0.2", features = ["rand"] }
44```
45
46Note that you must use the version of `rand` that `num-bigint` is compatible
47with: `0.5`.
48
49## Releases
50
51Release notes are available in [RELEASES.md](RELEASES.md).
52
53## Compatibility
54
55The `num-bigint` crate is tested for rustc 1.15 and greater.
56
57## Alternatives
58
59While `num-bigint` strives for good performance in pure Rust code, other
60crates may offer better performance with different trade-offs.  The following
61table offers a brief comparison to a few alternatives.
62
63| Crate            | License        | Min rustc | Implementation |
64| :--------------- | :------------- | :-------- | :------------- |
65| **`num-bigint`** | MIT/Apache-2.0 | 1.15      | pure rust |
66| [`ramp`]         | Apache-2.0     | nightly   | rust and inline assembly |
67| [`rug`]          | LGPL-3.0+      | 1.31      | bundles [GMP] via [`gmp-mpfr-sys`] |
68| [`rust-gmp`]     | MIT            | stable?   | links to [GMP] |
69| [`apint`]        | MIT/Apache-2.0 | 1.26      | pure rust (unfinished) |
70
71[GMP]: https://gmplib.org/
72[`gmp-mpfr-sys`]: https://crates.io/crates/gmp-mpfr-sys
73[`rug`]: https://crates.io/crates/rug
74[`rust-gmp`]: https://crates.io/crates/rust-gmp
75[`ramp`]: https://crates.io/crates/ramp
76[`apint`]: https://crates.io/crates/apint
77