8 releases

0.4.1 Jan 12, 2024
0.4.0 Sep 12, 2023
0.3.1 Dec 8, 2022
0.3.0 Nov 10, 2022
0.1.1 Jul 16, 2022

#1022 in Math

Download history 506/week @ 2024-07-30 462/week @ 2024-08-06 531/week @ 2024-08-13 1233/week @ 2024-08-20 1245/week @ 2024-08-27 1254/week @ 2024-09-03 1633/week @ 2024-09-10 1674/week @ 2024-09-17 3196/week @ 2024-09-24 5814/week @ 2024-10-01 6343/week @ 2024-10-08 4082/week @ 2024-10-15 3736/week @ 2024-10-22 2559/week @ 2024-10-29 3452/week @ 2024-11-05 2722/week @ 2024-11-12

13,364 downloads per month
Used in 45 crates (6 directly)

MIT/Apache

650KB
14K 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

  • Supports no_std and written in pure Rust.
  • 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

~280–580KB
~12K SLoC