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;
20
21/// An arbitrary precision rational, with `S` words of its numerator and denominator held inline.
22///
23/// The capacity is part of the type, so a crate implementing [`Absorb`](crate::Absorb) for its own
24/// narrow value against this one names the capacity it implements it for.
25pub type Big<const S: usize> = Ratio<Sign, Ubig<S>, NonZeroUbig<S>>;
26/// An arbitrary precision rational that is known not to be zero.
27pub type NonZeroBig<const S: usize> = Ratio<NonZeroSign, NonZeroUbig<S>, NonZeroUbig<S>>;
28
29/// An arbitrary precision type.
30pub type Big8 = Big<8>;
31/// A non zero arbitrary precision type.
32pub type NonZeroBig8 = NonZeroBig<8>;
33
34#[cfg(test)]
35mod test;