1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! `puremp` — arbitrary-precision arithmetic written entirely in Rust, depending
//! on no foreign code.
//!
//! It provides three families of numbers, built bottom-up:
//!
//! 1. **Integers** — unsigned [`Nat`] and signed [`Int`], the workhorse layer
//! that carries the hard limb-level algorithms (multiplication, division,
//! GCD, modular arithmetic, …). Enabled by the `int` feature.
//! 2. **Rationals** — [`Rational`], exact `p/q` fractions kept in lowest terms.
//! Enabled by the `rational` feature.
//! 3. **Floats** — [`Float`], binary floating-point with a caller-chosen
//! precision and directed [`RoundingMode`], aiming at MPFR-class correct
//! rounding. Enabled by the `float` feature.
//!
//! `puremp` is usable as a Rust library, a C library (the `ffi` feature; see
//! `include/puremp.h`), and a standalone command-line calculator (the `cli`
//! feature; the `puremp` binary).
//!
//! This is a clean-room implementation: it is MIT-licensed and its algorithms
//! are drawn from the open literature, never from GMP/MPFR source. See
//! `ROADMAP.md` for the design, the algorithm references, and the milestone
//! plan.
//!
//! # `no_std`
//!
//! The crate is `#![no_std]` at its core. Arbitrary-precision types are
//! heap-backed, so they need the `alloc` crate; the `alloc` feature (implied by
//! every type layer) pulls it in. The `std` feature (enabled by default) adds
//! the pieces that genuinely need the operating system — the CLI, `std::error`
//! integration, and system I/O. Build with `--no-default-features` for a bare
//! `no_std` target.
extern crate alloc;
extern crate std;
pub use ;
pub use ;
pub use Nat;
pub use Rational;
pub use ;
/// The crate version string (`CARGO_PKG_VERSION`), exposed for the C ABI and CLI.
pub const VERSION: &str = env!;