pub struct Finite<F: IsFinite>(/* private fields */);Implementations§
Source§impl<F: IsFinite> Finite<F>
impl<F: IsFinite> Finite<F>
Source§impl<F: IsFinite + Signed> Finite<F>
impl<F: IsFinite + Signed> Finite<F>
Sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Returns a number that represents the sign of self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITY
Sourcepub fn is_sign_negative(self) -> bool
pub fn is_sign_negative(self) -> bool
Returns true if self has a negative sign, including -0.0 and negative infinity.
Sourcepub fn is_sign_positive(self) -> bool
pub fn is_sign_positive(self) -> bool
Returns true if self has a positive sign, including +0.0 and positive infinity.
Source§impl<F: IsFinite> Finite<F>
impl<F: IsFinite> Finite<F>
Sourcepub fn try_add(self, rhs: impl IntoInner<F>) -> Result<Self, InfiniteError>where
F: Add<Output = F>,
pub fn try_add(self, rhs: impl IntoInner<F>) -> Result<Self, InfiniteError>where
F: Add<Output = F>,
Source§impl<F: IsFinite> Finite<F>
impl<F: IsFinite> Finite<F>
Sourcepub fn try_mul(self, rhs: impl IntoInner<F>) -> Result<Self, InfiniteError>where
F: Mul<Output = F>,
pub fn try_mul(self, rhs: impl IntoInner<F>) -> Result<Self, InfiniteError>where
F: Mul<Output = F>,
Sourcepub fn try_div(self, rhs: impl IntoInner<F>) -> Result<Self, InfiniteError>where
F: Div<Output = F>,
pub fn try_div(self, rhs: impl IntoInner<F>) -> Result<Self, InfiniteError>where
F: Div<Output = F>,
Source§impl<F: IsFinite + Pow> Finite<F>
impl<F: IsFinite + Pow> Finite<F>
Sourcepub fn try_powf(self, n: impl IntoInner<F>) -> Result<Self, InfiniteError>
pub fn try_powf(self, n: impl IntoInner<F>) -> Result<Self, InfiniteError>
Sourcepub fn try_powi(self, n: i32) -> Result<Self, InfiniteError>
pub fn try_powi(self, n: i32) -> Result<Self, InfiniteError>
Sourcepub fn try_recip(self) -> Result<Self, InfiniteError>
pub fn try_recip(self) -> Result<Self, InfiniteError>
Sourcepub fn try_sqrt(self) -> Result<Self, InfiniteError>
pub fn try_sqrt(self) -> Result<Self, InfiniteError>
Sourcepub fn try_hypot(self, other: impl IntoInner<F>) -> Result<Self, InfiniteError>
pub fn try_hypot(self, other: impl IntoInner<F>) -> Result<Self, InfiniteError>
Attempts to calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y.
Equivalent to sqrt(x^2 + y^2).
§Errors
If the result is non-finite.
Source§impl<F: IsFinite + Exp> Finite<F>
impl<F: IsFinite + Exp> Finite<F>
Sourcepub fn try_exp(self) -> Result<Self, InfiniteError>
pub fn try_exp(self) -> Result<Self, InfiniteError>
Sourcepub fn try_exp2(self) -> Result<Self, InfiniteError>
pub fn try_exp2(self) -> Result<Self, InfiniteError>
Sourcepub fn try_exp_m1(self) -> Result<Self, InfiniteError>
pub fn try_exp_m1(self) -> Result<Self, InfiniteError>
Attempts to find e^(self) - 1 in a way that is accurate even if the number is close to zero.
§Errors
If the result is non-finite.
Sourcepub fn exp_m1(self) -> Self
pub fn exp_m1(self) -> Self
Computes e^(self) - 1 more accurately than performing the operations separately.
§Panics
If the result is non-finite.
Sourcepub fn try_log(self, b: impl IntoInner<F>) -> Result<Self, InfiniteError>
pub fn try_log(self, b: impl IntoInner<F>) -> Result<Self, InfiniteError>
Sourcepub fn try_ln(self) -> Result<Self, InfiniteError>
pub fn try_ln(self) -> Result<Self, InfiniteError>
Sourcepub fn try_log2(self) -> Result<Self, InfiniteError>
pub fn try_log2(self) -> Result<Self, InfiniteError>
Sourcepub fn try_log10(self) -> Result<Self, InfiniteError>
pub fn try_log10(self) -> Result<Self, InfiniteError>
Sourcepub fn try_ln_1p(self) -> Result<Self, InfiniteError>
pub fn try_ln_1p(self) -> Result<Self, InfiniteError>
Attempts to find ln(1+n) (natural logarithm) more accurately than if the operations were performed separately.
§Errors
If the result is non-finite.
Source§impl<F: IsFinite + Trig> Finite<F>
impl<F: IsFinite + Trig> Finite<F>
Sourcepub fn try_tan(self) -> Result<Self, InfiniteError>
pub fn try_tan(self) -> Result<Self, InfiniteError>
Sourcepub fn try_asin(self) -> Result<Self, InfiniteError>
pub fn try_asin(self) -> Result<Self, InfiniteError>
Attempts to compute the arcsine of a number (in radians).
§Errors
If the result is non-finite (caused if the magnitude of the input exceeds 1).
Sourcepub fn try_acos(self) -> Result<Self, InfiniteError>
pub fn try_acos(self) -> Result<Self, InfiniteError>
Attempts to compute the arccosine of a number (in radians).
§Errors
If the result is non-finite (caused if the magnitude of the input exceeds 1).
Sourcepub fn asin(self) -> Self
pub fn asin(self) -> Self
Computes the arcsine of a number.
§Panics
If the result is non-finite (caused if the magnitude of the input exceeds 1).
Sourcepub fn acos(self) -> Self
pub fn acos(self) -> Self
Computes the arccosine of a number.
§Panics
If the result is non-finite (caused if the magnitude of the input exceeds 1).
Sourcepub fn try_atan2(self, other: impl IntoInner<F>) -> Result<Self, InfiniteError>
pub fn try_atan2(self, other: impl IntoInner<F>) -> Result<Self, InfiniteError>
Attempts to compute the four quadrant arctangent of self (y) and other (x) in radians.
§Errors
If the result is non-finite.
Trait Implementations§
Source§impl<F: IsFinite + Add<Output = F>, Rhs: IntoInner<F>> AddAssign<Rhs> for Finite<F>
impl<F: IsFinite + Add<Output = F>, Rhs: IntoInner<F>> AddAssign<Rhs> for Finite<F>
Source§fn add_assign(&mut self, rhs: Rhs)
fn add_assign(&mut self, rhs: Rhs)
+= operation. Read moreSource§impl<F: IsFinite + Div<Output = F>, Rhs: IntoInner<F>> DivAssign<Rhs> for Finite<F>
impl<F: IsFinite + Div<Output = F>, Rhs: IntoInner<F>> DivAssign<Rhs> for Finite<F>
Source§fn div_assign(&mut self, rhs: Rhs)
fn div_assign(&mut self, rhs: Rhs)
/= operation. Read moreSource§impl<F: IsFinite + Mul<Output = F>, Rhs: IntoInner<F>> MulAssign<Rhs> for Finite<F>
impl<F: IsFinite + Mul<Output = F>, Rhs: IntoInner<F>> MulAssign<Rhs> for Finite<F>
Source§fn mul_assign(&mut self, rhs: Rhs)
fn mul_assign(&mut self, rhs: Rhs)
*= operation. Read moreSource§impl<F: IsFinite + ToOrd> Ord for Finite<F>
impl<F: IsFinite + ToOrd> Ord for Finite<F>
Source§impl<F: IsFinite + ToOrd, Rhs: IntoInner<F> + Copy> PartialOrd<Rhs> for Finite<F>
impl<F: IsFinite + ToOrd, Rhs: IntoInner<F> + Copy> PartialOrd<Rhs> for Finite<F>
Source§impl<F: IsFinite + Rem<Output = F>, Rhs: IntoInner<F>> RemAssign<Rhs> for Finite<F>
impl<F: IsFinite + Rem<Output = F>, Rhs: IntoInner<F>> RemAssign<Rhs> for Finite<F>
Source§fn rem_assign(&mut self, rhs: Rhs)
fn rem_assign(&mut self, rhs: Rhs)
%= operation. Read moreSource§impl<F: IsFinite + Sub<Output = F>, Rhs: IntoInner<F>> SubAssign<Rhs> for Finite<F>
impl<F: IsFinite + Sub<Output = F>, Rhs: IntoInner<F>> SubAssign<Rhs> for Finite<F>
Source§fn sub_assign(&mut self, rhs: Rhs)
fn sub_assign(&mut self, rhs: Rhs)
-= operation. Read more