#mathematics #numerics #integer #bigint #arbitrary-precision

no-std dashu-int

A big integer library with good performance

3 unstable releases

Uses new Rust 2021

0.2.0 Sep 13, 2022
0.1.1 Jul 16, 2022
0.1.0 Jul 10, 2022

#265 in Math

Download history 21/week @ 2022-07-06 36/week @ 2022-07-13 16/week @ 2022-07-20 11/week @ 2022-07-27 6/week @ 2022-08-03 9/week @ 2022-08-10 5/week @ 2022-08-17 4/week @ 2022-08-24 3/week @ 2022-08-31 20/week @ 2022-09-07 42/week @ 2022-09-14 13/week @ 2022-09-21

78 downloads per month
Used in 3 crates

MIT/Apache

545KB
13K SLoC

dashu-int

Arbitrary precision integer implementation as a part of the dashu library. See Docs.rs for the full documentation.

The majority of the code is based on the ibig crate. The modification notice based on the the original ibig repo is included in the NOTICE file.

Features

  • Support for both unsigned and signed big integers.
  • Small integers are inlined on stack with specialized algorithms.
  • Efficient implementation for basic arithmetic operations (+,-,*,/,%,<<,>>).
  • Support advanced arithmetic operations including pow, ilog, gcd, gcd_ext.
  • Bit operations for signed big integers follow the 2's complement rule.
  • Efficient implementation for modular arithmetics (e.g. modular powering and inverse).
  • Efficient integer parsing and printing with base 2~36.
  • Developer friendly debug printing for big integers.
  • Direct access to underlying machine word array.

Optional dependencies

  • std (default): for std::error::Error.
  • num-traits (default): integral traits.
  • rand (default): random number generation.
  • serde: serialization and deserialization.

Performance

See the built-in benchmark.

License

See the top-level readme.

Dependencies

~420–680KB
~12K SLoC