[−][src]Struct inari::Interval
The bare inf-sup interval type with f64
bounds.
Implementations
impl Interval
[src]
pub fn abs(self) -> Self
[src]
Returns the absolute value of self
.
Tightness: tightest
pub fn max(self, rhs: Self) -> Self
[src]
Returns $[\max(a, c), \max(b, d)]$ if both $\self = [a, b]$ and $\rhs = [c, d]$ are nonempty; otherwise, $∅$.
Tightness: tightest
pub fn min(self, rhs: Self) -> Self
[src]
Returns $[\min(a, c), \min(b, d)]$ if both $\self = [a, b]$ and $\rhs = [c, d]$ are nonempty; otherwise $∅$.
Tightness: tightest
impl Interval
[src]
pub fn mul_add(self, rhs: Self, addend: Self) -> Self
[src]
Returns $\self × \rhs + \addend$.
Tightness: tightest
pub fn recip(self) -> Self
[src]
Returns the multiplicative inverse of self
.
Tightness: tightest
pub fn sqr(self) -> Self
[src]
Returns the square of self
.
Tightness: tightest
pub fn sqrt(self) -> Self
[src]
Returns the principal square root of self
.
Tightness: tightest
impl Interval
[src]
pub fn contains(self, rhs: f64) -> bool
[src]
Returns true
if rhs
is a member of self
($\rhs ∈ \self$).
If rhs
is not a real number, false
is returned.
pub fn disjoint(self, rhs: Self) -> bool
[src]
Returns true
if self
and rhs
are disjoint ($\self ∩ \rhs = ∅$).
Formal Definition
$∀x ∈ \self, ∀y ∈ \rhs : x ≠ y$.
pub fn interior(self, rhs: Self) -> bool
[src]
Returns true
if self
is interior to rhs
.
Formal Definition
$(∀x ∈ \self, ∃y ∈ \rhs : x < y) ∧ (∀x ∈ \self, ∃y ∈ \rhs : y < x)$.
pub fn is_common_interval(self) -> bool
[src]
Returns true
if self
is nonempty and bounded.
pub fn is_empty(self) -> bool
[src]
Returns true
if self
is empty ($\self = ∅$).
pub fn is_entire(self) -> bool
[src]
Returns true
if $\self = [-∞, ∞]$.
pub fn is_singleton(self) -> bool
[src]
Returns true
if self
consists of a single real number.
pub fn less(self, rhs: Self) -> bool
[src]
Returns true
if self
is weakly less than rhs
.
Formal Definition
$(∀x ∈ \self, ∃y ∈ \rhs : x ≤ y) ∧ (∀y ∈ \rhs, ∃x ∈ \self : x ≤ y)$.
pub fn precedes(self, rhs: Self) -> bool
[src]
Returns true
if self
is to the left of but may touch rhs
.
Formal Definition
$∀x ∈ \self, ∀y ∈ \rhs : x ≤ y$.
pub fn strict_less(self, rhs: Self) -> bool
[src]
Returns true
if self
is strictly less than rhs
.
Formal Definition
$(∀x ∈ \self, ∃y ∈ \rhs : x < y) ∧ (∀y ∈ \self, ∃x ∈ \rhs : x < y)$.
pub fn strict_precedes(self, rhs: Self) -> bool
[src]
Returns true
if self
is strictly to the left of rhs
.
Formal Definition
$∀x ∈ \self, ∀y ∈ \rhs : x < y$.
pub fn subset(self, rhs: Self) -> bool
[src]
Returns true
if self
is a subset of rhs
($\self ⊆ \rhs$).
Formal Definition
$∀x ∈ \self, ∃y ∈ \rhs : x = y$.
impl Interval
[src]
pub fn to_be_bytes(self) -> [u8; 16]
[src]
Returns the big-endian interchange representation of self
.
pub fn to_le_bytes(self) -> [u8; 16]
[src]
Returns the little-endian interchange representation of self
.
pub fn to_ne_bytes(self) -> [u8; 16]
[src]
Returns the native-byte-order interchange representation of self
.
pub fn try_from_be_bytes(bytes: [u8; 16]) -> Result<Self>
[src]
Creates an interval from its big-endian interchange representation.
pub fn try_from_le_bytes(bytes: [u8; 16]) -> Result<Self>
[src]
Creates an interval from its little-endian interchange representation.
pub fn try_from_ne_bytes(bytes: [u8; 16]) -> Result<Self>
[src]
Creates an interval from its native-byte-order interchange representation.
impl Interval
[src]
pub const EMPTY: Self
[src]
$∅$, the empty interval.
pub const ENTIRE: Self
[src]
$[-∞, ∞]$.
pub const E: Self
[src]
The tightest interval enclosing $\e$, the base of natural logarithms.
pub const FRAC_1_PI: Self
[src]
The tightest interval enclosing $1 / \pi$.
pub const FRAC_1_SQRT_2: Self
[src]
The tightest interval enclosing $1 / \sqrt{2}$.
pub const FRAC_2_PI: Self
[src]
The tightest interval enclosing $2 / \pi$.
pub const FRAC_2_SQRT_PI: Self
[src]
The tightest interval enclosing $2 / \sqrt{\pi}$.
pub const FRAC_PI_2: Self
[src]
The tightest interval enclosing $\pi / 2$.
pub const FRAC_PI_3: Self
[src]
The tightest interval enclosing $\pi / 3$.
pub const FRAC_PI_4: Self
[src]
The tightest interval enclosing $\pi / 4$.
pub const FRAC_PI_6: Self
[src]
The tightest interval enclosing $\pi / 6$.
pub const FRAC_PI_8: Self
[src]
The tightest interval enclosing $\pi / 8$.
pub const LN_10: Self
[src]
The tightest interval enclosing $\ln 10$.
pub const LN_2: Self
[src]
The tightest interval enclosing $\ln 2$.
pub const LOG10_2: Self
[src]
The tightest interval enclosing $\log_{10} 2$.
pub const LOG10_E: Self
[src]
The tightest interval enclosing $\log_{10} \e$.
pub const LOG2_10: Self
[src]
The tightest interval enclosing $\log_2 10$.
pub const LOG2_E: Self
[src]
The tightest interval enclosing $\log_2 \e$.
pub const PI: Self
[src]
The tightest interval enclosing $\pi$.
pub const SQRT_2: Self
[src]
The tightest interval enclosing $\sqrt{2}$.
pub const TAU: Self
[src]
The tightest interval enclosing $2 \pi$.
impl Interval
[src]
pub fn acos(self) -> Self
[src]
Returns the inverse cosine of self
.
Tightness: tightest
pub fn acosh(self) -> Self
[src]
Returns the inverse hyperbolic cosine of self
.
Tightness: tightest
pub fn asin(self) -> Self
[src]
Returns the inverse sine of self
.
Tightness: tightest
pub fn asinh(self) -> Self
[src]
Returns the inverse hyperbolic sine of self
.
Tightness: tightest
pub fn atan(self) -> Self
[src]
Returns the inverse tangent of self
.
Tightness: tightest
pub fn atan2(self, rhs: Self) -> Self
[src]
Returns the angle of the point $(\rhs, \self)$ measured counterclockwise from the positive $x$-axis in the Euclidean $xy$-plane.
Tightness: tightest
pub fn atanh(self) -> Self
[src]
Returns the inverse hyperbolic tangent of self
.
Tightness: tightest
pub fn cos(self) -> Self
[src]
Returns the cosine of self
.
Tightness: tightest
pub fn cosh(self) -> Self
[src]
Returns the hyperbolic cosine of self
.
Tightness: tightest
pub fn exp(self) -> Self
[src]
Returns the exponential of self
.
Tightness: tightest
pub fn exp10(self) -> Self
[src]
Returns self
raised to the power of 10.
Tightness: tightest
pub fn exp2(self) -> Self
[src]
Returns self
raised to the power of 2.
Tightness: tightest
pub fn ln(self) -> Self
[src]
Returns the natural logarithm of self
.
Tightness: tightest
pub fn log10(self) -> Self
[src]
Returns the base-10 logarithm of self
.
Tightness: tightest
pub fn log2(self) -> Self
[src]
Returns the base-2 logarithm of self
.
Tightness: tightest
pub fn pow(self, rhs: Self) -> Self
[src]
Returns self
raised to the power of rhs
.
Tightness: tightest
pub fn pown(self, rhs: i32) -> Self
[src]
Returns self
raised to the power of rhs
, where rhs
is an integer.
Tightness: tightest
pub fn sin(self) -> Self
[src]
Returns the sine of self
.
Tightness: tightest
pub fn sinh(self) -> Self
[src]
Returns the hyperbolic sine of self
.
Tightness: tightest
pub fn tan(self) -> Self
[src]
Returns the tangent of self
.
Tightness: tightest
pub fn tanh(self) -> Self
[src]
Returns the hyperbolic tangent of self
.
Tightness: tightest
impl Interval
[src]
pub fn ceil(self) -> Self
[src]
Rounds the bounds of self
to integers using directed rounding toward $+∞$.
Tightness: tightest
Examples
assert_eq!(const_interval!(1.2, 2.8).ceil(), const_interval!(2.0, 3.0)); assert_eq!(const_interval!(-2.8, -1.2).ceil(), const_interval!(-2.0, -1.0));
See also: Interval::floor
, Interval::trunc
.
pub fn floor(self) -> Self
[src]
Rounds the bounds of self
to integers using directed rounding toward $-∞$.
Tightness: tightest
See also: Interval::ceil
, Interval::trunc
.
pub fn round_ties_to_away(self) -> Self
[src]
Rounds the bounds of self
to the nearest integers,
with halfway cases rounded away from zero.
Tightness: tightest
See also: Interval::round_ties_to_even
.
pub fn round_ties_to_even(self) -> Self
[src]
Rounds the bounds of self
to the nearest integers,
with halfway cases rounded to even numbers.
Tightness: tightest
See also: Interval::round_ties_to_away
.
pub fn sign(self) -> Self
[src]
Returns the sign of self
.
Note the difference between the sign function and f64::signum
; $\sgn(0)$ is always zero,
while the values of +0.0_f64.signum()
and -0.0_f64.signum()
are +1.0
and -1.0
, respectively.
Tightness: tightest
pub fn trunc(self) -> Self
[src]
Rounds the bounds of self
to integers using directed rounding toward zero.
Tightness: tightest
See also: Interval::ceil
, Interval::floor
.
impl Interval
[src]
pub fn inf(self) -> f64
[src]
Returns the (greatest) lower bound of self
.
Equivalently, it returns $a$ if $\self = [a, b]$ is nonempty; otherwise, $+∞$.
See also: Interval::sup
.
pub fn mag(self) -> f64
[src]
Returns the magnitude of self
if self
is nonempty; otherwise, NaN.
The magnitude of a nonempty interval $𝒙 = [a, b]$ is defined as follows:
$$ \operatorname{mag}(𝒙) = \sup\{|x| ∣ x ∈ 𝒙\} = \max(|a|, |b|). $$
See also: Interval::mig
.
pub fn mid(self) -> f64
[src]
Returns the midpoint of self
if self
is nonempty; otherwise, NaN.
For nonempty cases, the following values are returned.
- If $\self = [-∞, +∞]$, zero is returned.
- If $\self = [-∞, b]$ where $b < +∞$,
f64::MIN
is returned. - If $\self = [a, +∞]$ where $a > -∞$,
f64::MAX
is returned. - If
self
is bounded, $\operatorname{mid}(\self)$ rounded to the nearestf64
value is returned.
The midpoint of a nonempty interval $𝒙 = [a, b]$ is defined as follows:
$$ \operatorname{mid}(𝒙) = \frac{1}{2}(a + b). $$
See also: Interval::rad
.
pub fn mig(self) -> f64
[src]
Returns the mignitude of self
if self
is nonempty; otherwise, NaN.
The mignitude of a nonempty interval $𝒙 = [a, b]$ is defined as follows:
$$ \operatorname{mig}(𝒙) = \inf\{|x| ∣ x ∈ 𝒙\} = \begin{cases} \min(|a|, |b|) & \text{if } \sgn(a) = \sgn(b), \\ 0 & \text{otherwise}. \end{cases} $$
See also: Interval::mag
.
pub fn rad(self) -> f64
[src]
Returns the radius of self
if self
is nonempty; otherwise, NaN.
The result $r$ is the smallest f64
number that satisfies
$\self ⊆ [m - r, m + r]$ where $m$ is the f64
value returned by self.mid()
.
The radius of a nonempty interval $𝒙 = [a, b]$ is defined as follows:
$$ \operatorname{rad}(𝒙) = \frac{1}{2}(b - a). $$
See also: Interval::mid
.
pub fn sup(self) -> f64
[src]
Returns the (least) upper bound of self
.
Equivalently, it returns $b$ if $\self = [a, b]$ is nonempty; otherwise, $-∞$.
See also: Interval::inf
.
pub fn wid(self) -> f64
[src]
Returns the width of self
if self
is nonempty; otherwise, NaN.
The result is rounded toward $+∞$.
The width of a nonempty interval $𝒙 = [a, b]$ is defined as follows:
$$ \operatorname{wid}(𝒙) = b - a. $$
impl Interval
[src]
pub fn overlap(self, rhs: Self) -> OverlappingState
[src]
Returns the overlapping state of self
and rhs
. See OverlappingState
for the possible values returned.
impl Interval
[src]
pub fn convex_hull(self, rhs: Self) -> Self
[src]
Returns $[\min(a, c), \max(b, d)]$ if both $\self = [a, b]$ and $\rhs = [c, d]$ are nonempty. If either interval is empty, the other is returned. If both are empty, $∅$ is returned.
This is equivalent to $\self ∪ \rhs$ if the intervals are not disjoint,
Tightness: tightest
pub fn intersection(self, rhs: Self) -> Self
[src]
Returns $\self ∩ \rhs$. If the result is nonempty, it is equivalent to $[\max(a, c), \min(b, d)]$, where both $\self = [a, b]$ and $\rhs = [c, d]$ are nonempty..
Tightness: tightest
Trait Implementations
impl Add<Interval> for Interval
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
Tightness: tightest
impl AddAssign<Interval> for Interval
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl Clone for Interval
[src]
impl Copy for Interval
[src]
impl Debug for Interval
[src]
impl Display for Interval
[src]
impl Div<Interval> for Interval
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self
[src]
Tightness: tightest
impl DivAssign<Interval> for Interval
[src]
fn div_assign(&mut self, rhs: Self)
[src]
impl Eq for Interval
[src]
impl FromStr for Interval
[src]
type Err = IntervalError<Self>
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self>
[src]
impl LowerExp for Interval
[src]
impl LowerHex for Interval
[src]
impl Mul<Interval> for Interval
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self
[src]
Tightness: tightest
impl MulAssign<Interval> for Interval
[src]
fn mul_assign(&mut self, rhs: Self)
[src]
impl Neg for Interval
[src]
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self
[src]
Tightness: tightest
impl PartialEq<Interval> for Interval
[src]
impl Sub<Interval> for Interval
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
Tightness: tightest
impl SubAssign<Interval> for Interval
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl TryFrom<(f64, f64)> for Interval
[src]
Auto Trait Implementations
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Az for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedAs for T
[src]
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
T: CheckedCast<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OverflowingAs for T
[src]
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
T: OverflowingCast<Dst>,
impl<T> SaturatingAs for T
[src]
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
T: SaturatingCast<Dst>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WrappingAs for T
[src]
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
T: WrappingCast<Dst>,