relp_num/rational/big/mod.rs
1//! # An arbitrary precision rational type
2//!
3//! At the moment, this is just wrapping the `num::BigRational` type, following the newtype pattern.
4//! This is needed because some of the impl's in this module are not provided by `num`. Methods on
5//! this type can be modified and specialized as needed.
6use crate::{NonZeroSign, Sign, Ubig};
7use crate::integer::big::NonZeroUbig;
8use crate::rational::Ratio;
9
10pub (crate) mod io;
11pub(crate) mod properties;
12pub mod ops;
13mod with_small_rational;
14mod with_integer;
15mod with_binary;
16mod with_zero;
17mod with_one;
18mod with_option;
19mod absorb;
20mod gcd;
21mod narrow;
22mod size;
23
24/// An arbitrary precision rational, with `S` words of its numerator and denominator held inline.
25///
26/// The capacity is part of the type, so a crate implementing [`Absorb`](crate::Absorb) for its own
27/// narrow value against this one names the capacity it implements it for.
28pub type Big<const S: usize> = Ratio<Sign, Ubig<S>, NonZeroUbig<S>>;
29/// An arbitrary precision rational that is known not to be zero.
30pub type NonZeroBig<const S: usize> = Ratio<NonZeroSign, NonZeroUbig<S>, NonZeroUbig<S>>;
31
32/// An arbitrary precision type.
33pub type Big8 = Big<8>;
34/// A non zero arbitrary precision type.
35pub type NonZeroBig8 = NonZeroBig<8>;
36
37#[cfg(test)]
38mod test;