secret_cosmwasm_std/math/fraction.rs
1/// A fraction `p`/`q` with integers `p` and `q`.
2///
3/// `p` is called the numerator and `q` is called the denominator.
4pub trait Fraction<T>: Sized {
5 /// Returns the numerator `p`
6 fn numerator(&self) -> T;
7 /// Returns the denominator `q`
8 fn denominator(&self) -> T;
9
10 /// Returns the multiplicative inverse `q/p` for fraction `p/q`.
11 ///
12 /// If `p` is zero, None is returned.
13 fn inv(&self) -> Option<Self>;
14}