pub struct Interval { /* private fields */ }Expand description
A closed interval [lo, hi] certainly containing a true real value.
Implementations§
Source§impl Interval
impl Interval
Sourcepub const fn point(value: f64) -> Self
pub const fn point(value: f64) -> Self
The degenerate interval holding one exactly-represented value.
Sourcepub fn new(lo: f64, hi: f64) -> Self
pub fn new(lo: f64, hi: f64) -> Self
An interval from stated bounds. Panics if lo > hi or either is NaN,
because such an “enclosure” encloses nothing.
Sourcepub fn certain_sign(&self) -> Option<Sign>
pub fn certain_sign(&self) -> Option<Sign>
The sign of the true value, where the bounds decide it: None means
zero lies inside the enclosure and floating point genuinely cannot
tell, which is an answer, not a failure.
Sourcepub fn mul(&self, other: &Self) -> Self
pub fn mul(&self, other: &Self) -> Self
The product: the extremes over the four bound products, widened.
Sourcepub fn square(&self) -> Self
pub fn square(&self) -> Self
The square, tighter than mul with itself, because a square cannot
be negative even when the interval straddles zero.
Sourcepub fn sqrt(&self) -> Option<Self>
pub fn sqrt(&self) -> Option<Self>
The square root, for enclosures of non-negative values. A lower bound
pushed below zero by widening is clamped; the true value it encloses
was non-negative. An interval entirely below zero has no real root
and returns None.
Sourcepub fn checked_div(&self, other: &Self) -> Option<Self>
pub fn checked_div(&self, other: &Self) -> Option<Self>
The quotient, defined only when the divisor certainly excludes zero.
Trait Implementations§
impl Copy for Interval
impl StructuralPartialEq for Interval
Auto Trait Implementations§
impl Freeze for Interval
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnsafeUnpin for Interval
impl UnwindSafe for Interval
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.