pub struct Dyadic { /* private fields */ }Expand description
An exact dyadic rational: an arbitrary-precision integer mantissa times a power of two.
Every finite f64 converts exactly, and addition, subtraction and
multiplication never round or overflow. Equality and ordering compare
values, not representations.
§Examples
use implicit_predicates_oracle::Dyadic;
let tenth = Dyadic::from_f64(0.1);
let three_tenths = &(&tenth + &tenth) + &tenth;
// 0.1 + 0.1 + 0.1 is not 0.3 in binary, and the oracle sees the difference.
assert_eq!(three_tenths.sign(), 1);
assert!(three_tenths > Dyadic::from_f64(0.3));Implementations§
Source§impl Dyadic
impl Dyadic
Trait Implementations§
impl Eq for Dyadic
Source§impl Ord for Dyadic
impl Ord for Dyadic
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Dyadic
impl PartialOrd for Dyadic
Auto Trait Implementations§
impl Forget for Dyadic
impl Freeze for Dyadic
impl Move for Dyadic
impl RefUnwindSafe for Dyadic
impl Send for Dyadic
impl Sync for Dyadic
impl Unpin for Dyadic
impl UnsafeUnpin for Dyadic
impl UnwindSafe for Dyadic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more