pub trait Rational: 'static + Default + Copy + Sealed {
const F64: f64;
// Required method
fn borrow<'a>() -> &'a Self;
}
Expand description
Type-level rational numbers.
Required Associated Constants§
sourceconst F64: f64
const F64: f64
Approximate 64-bit floating point number of this rational number.
§Examples
use typerat::*;
assert_eq!(Q::<Z0>::F64, 0_f64);
assert_eq!(Q::<P1>::F64, 1_f64);
assert_eq!(Q::<N1>::F64, -1_f64);
assert_eq!(Q::<N1, P2>::F64, -0.5_f64);
assert_eq!(Q::<P1, P3>::F64, 1_f64 / 3_f64);
assert_eq!(Q::<N5, P3>::F64, -1_f64 - 1_f64 / 1.5_f64);
Required Methods§
Object Safety§
This trait is not object safe.