pub struct Ball {
pub lo: Rational,
pub hi: Rational,
}Expand description
A rigorous rational enclosure of a real number.
Fields§
§lo: Rational§hi: RationalImplementations§
Source§impl Ball
impl Ball
Sourcepub fn new(lo: Rational, hi: Rational) -> Self
pub fn new(lo: Rational, hi: Rational) -> Self
An enclosure [lo, hi] (endpoints are swapped if given out of order).
Sourcepub fn sign(&self) -> Option<Sign>
pub fn sign(&self) -> Option<Sign>
Sign of the enclosed value, or None if the ball straddles zero
(the caller must refine and retry).
Sourcepub fn cmp(&self, other: &Ball) -> Option<Ordering>
pub fn cmp(&self, other: &Ball) -> Option<Ordering>
Ordering against another ball, or None if the two overlap (refine).
Sourcepub fn contains_zero(&self) -> bool
pub fn contains_zero(&self) -> bool
Whether the enclosure contains zero.
Sourcepub fn to_f64(&self) -> f64
pub fn to_f64(&self) -> f64
Nearest f64 to the midpoint (endpoints are small, so this is finite).
Trait Implementations§
impl Eq for Ball
impl StructuralPartialEq for Ball
Auto Trait Implementations§
impl Freeze for Ball
impl RefUnwindSafe for Ball
impl Send for Ball
impl Sync for Ball
impl Unpin for Ball
impl UnsafeUnpin for Ball
impl UnwindSafe for Ball
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more