ebi/
fraction.rs

1//======================== set type alias based on compile flags ========================//
2
3#[cfg(any(
4    all(
5        not(feature = "exactarithmetic"),
6        not(feature = "approximatearithmetic")
7    ),
8    all(feature = "exactarithmetic", feature = "approximatearithmetic")
9))]
10pub type Fraction = super::fraction_enum::FractionEnum;
11
12#[cfg(all(not(feature = "exactarithmetic"), feature = "approximatearithmetic"))]
13pub type Fraction = super::fraction_f64::FractionF64;
14
15#[cfg(all(feature = "exactarithmetic", not(feature = "approximatearithmetic")))]
16pub type Fraction = super::fraction_exact::FractionExact;
17
18//======================== fraction tools ========================//
19
20pub type UInt = fraction::BigUint;
21pub const APPROX_DIGITS: u64 = 5;
22pub const EPSILON: f64 = 1e-13;
23
24#[macro_export]
25/// Convenience short-hand macro to create fractions.
26macro_rules! f {
27    ($e: expr) => {
28        Fraction::from($e)
29    };
30
31    ($e: expr, $f: expr) => {
32        Fraction::from(($e, $f))
33    };
34}
35pub use f;