Enum roqoqo::CalculatorFloat
source · [−]Expand description
CalculatorFloat is an enum combining Float and String.
Variants
Float
- f64 valueStr
- String instance
Variants
Float(f64)
Floating point value
Str(String)
Symbolic expression in String form
Implementations
sourceimpl CalculatorFloat
impl CalculatorFloat
sourcepub const ZERO: CalculatorFloat
pub const ZERO: CalculatorFloat
Constant zero for CalculatorFloat
sourcepub const ONE: CalculatorFloat
pub const ONE: CalculatorFloat
Constant one for CalculatorFloat
sourcepub const PI: CalculatorFloat
pub const PI: CalculatorFloat
Constant pi for CalculatorFloat
sourcepub const E: CalculatorFloat
pub const E: CalculatorFloat
Constant Euler’s number e for CalculatorFloat
sourcepub const FRAC_1_SQRT_2: CalculatorFloat
pub const FRAC_1_SQRT_2: CalculatorFloat
Constant 1/sqrt(2) e for CalculatorFloat
sourcepub const FRAC_PI_2: CalculatorFloat
pub const FRAC_PI_2: CalculatorFloat
Constant pi / 2 e for CalculatorFloat
sourcepub const FRAC_PI_4: CalculatorFloat
pub const FRAC_PI_4: CalculatorFloat
Constant pi / 4 e for CalculatorFloat
sourcepub const SQRT_2: CalculatorFloat
pub const SQRT_2: CalculatorFloat
Constant sqrt(2) e for CalculatorFloat
sourcepub fn is_float(&self) -> bool
pub fn is_float(&self) -> bool
Return True when CalculatorFloat does not contain symbolic expression.
sourcepub fn sqrt(&self) -> CalculatorFloat
pub fn sqrt(&self) -> CalculatorFloat
Return square root of CalculatorFloat.
sourcepub fn atan2<T>(&self, other: T) -> CalculatorFloat where
CalculatorFloat: From<T>,
pub fn atan2<T>(&self, other: T) -> CalculatorFloat where
CalculatorFloat: From<T>,
Return atan2 for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
sourcepub fn powf<T>(&self, other: T) -> CalculatorFloat where
CalculatorFloat: From<T>,
pub fn powf<T>(&self, other: T) -> CalculatorFloat where
CalculatorFloat: From<T>,
Return Power for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
sourcepub fn exp(&self) -> CalculatorFloat
pub fn exp(&self) -> CalculatorFloat
Return exponential function exp(x) for CalculatorFloat.
sourcepub fn sin(&self) -> CalculatorFloat
pub fn sin(&self) -> CalculatorFloat
Return sine function sin(x) for CalculatorFloat.
sourcepub fn cos(&self) -> CalculatorFloat
pub fn cos(&self) -> CalculatorFloat
Return cosine function cos(x) for CalculatorFloat.
sourcepub fn acos(&self) -> CalculatorFloat
pub fn acos(&self) -> CalculatorFloat
Return arccosine function acos(x) for CalculatorFloat.
sourcepub fn abs(&self) -> CalculatorFloat
pub fn abs(&self) -> CalculatorFloat
Return absolute value abs(x) for CalculatorFloat.
sourcepub fn signum(&self) -> CalculatorFloat
pub fn signum(&self) -> CalculatorFloat
Return signum value sign(x) for CalculatorFloat.
sourcepub fn isclose<T>(&self, other: T) -> bool where
CalculatorFloat: From<T>,
pub fn isclose<T>(&self, other: T) -> bool where
CalculatorFloat: From<T>,
Return True if self value is close to other value.
sourcepub fn float(&self) -> Result<&f64, CalculatorError>
pub fn float(&self) -> Result<&f64, CalculatorError>
Return Some(f64) when CalculatorFloat is a numeric value
sourcepub fn recip(&self) -> CalculatorFloat
pub fn recip(&self) -> CalculatorFloat
Return inverse/reciprocal function (1/x) for CalculatorFloat.
Trait Implementations
sourceimpl<'a, T> Add<T> for &'a CalculatorFloat where
CalculatorFloat: From<T>,
impl<'a, T> Add<T> for &'a CalculatorFloat where
CalculatorFloat: From<T>,
Implement +
(add) for &CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
type Output = CalculatorFloat
type Output = CalculatorFloat
The resulting type after applying the +
operator.
sourcepub fn add(self, other: T) -> CalculatorFloat
pub fn add(self, other: T) -> CalculatorFloat
Performs the +
operation. Read more
sourceimpl<T> Add<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> Add<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement +
(add) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
type Output = CalculatorFloat
type Output = CalculatorFloat
The resulting type after applying the +
operator.
sourcepub fn add(self, other: T) -> CalculatorFloat
pub fn add(self, other: T) -> CalculatorFloat
Performs the +
operation. Read more
sourceimpl<T> AddAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> AddAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement +=
(add) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
sourcepub fn add_assign(&mut self, other: T)
pub fn add_assign(&mut self, other: T)
Performs the +=
operation. Read more
sourceimpl Clone for CalculatorFloat
impl Clone for CalculatorFloat
sourcepub fn clone(&self) -> CalculatorFloat
pub fn clone(&self) -> CalculatorFloat
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CalculatorFloat
impl Debug for CalculatorFloat
sourceimpl<'de> Deserialize<'de> for CalculatorFloat
impl<'de> Deserialize<'de> for CalculatorFloat
sourcepub fn deserialize<D>(
deserializer: D
) -> Result<CalculatorFloat, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<CalculatorFloat, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for CalculatorFloat
impl Display for CalculatorFloat
Implement Display trait for CalculatorFloat.
Allows use of simple text formating
sourceimpl<T> Div<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> Div<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement /
(divide) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
Panics
Panics on division by zero. Division by zero is only detected when other is converted to CalculatorFloat::Float
type Output = CalculatorFloat
type Output = CalculatorFloat
The resulting type after applying the /
operator.
sourcepub fn div(self, other: T) -> CalculatorFloat
pub fn div(self, other: T) -> CalculatorFloat
Performs the /
operation. Read more
sourceimpl<T> DivAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> DivAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement /=
(divide) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
Panics
Panics on division by zero. Division by zero is only detected when other is converted to CalculatorFloat::Float
sourcepub fn div_assign(&mut self, other: T)
pub fn div_assign(&mut self, other: T)
Performs the /=
operation. Read more
sourceimpl<'_> From<&'_ String> for CalculatorFloat
impl<'_> From<&'_ String> for CalculatorFloat
sourcepub fn from(item: &String) -> CalculatorFloat
pub fn from(item: &String) -> CalculatorFloat
Performs the conversion.
sourceimpl<'_> From<&'_ str> for CalculatorFloat
impl<'_> From<&'_ str> for CalculatorFloat
sourcepub fn from(item: &str) -> CalculatorFloat
pub fn from(item: &str) -> CalculatorFloat
Performs the conversion.
sourceimpl<'a> From<&'a CalculatorFloat> for CalculatorFloat
impl<'a> From<&'a CalculatorFloat> for CalculatorFloat
sourcepub fn from(item: &'a CalculatorFloat) -> CalculatorFloat
pub fn from(item: &'a CalculatorFloat) -> CalculatorFloat
Performs the conversion.
sourceimpl<'a> From<&'a f64> for CalculatorFloat
impl<'a> From<&'a f64> for CalculatorFloat
sourcepub fn from(item: &'a f64) -> CalculatorFloat
pub fn from(item: &'a f64) -> CalculatorFloat
Performs the conversion.
sourceimpl<'a> From<&'a i32> for CalculatorFloat
impl<'a> From<&'a i32> for CalculatorFloat
sourcepub fn from(item: &'a i32) -> CalculatorFloat
pub fn from(item: &'a i32) -> CalculatorFloat
Performs the conversion.
sourceimpl<'a> From<&'a u32> for CalculatorFloat
impl<'a> From<&'a u32> for CalculatorFloat
sourcepub fn from(item: &'a u32) -> CalculatorFloat
pub fn from(item: &'a u32) -> CalculatorFloat
Performs the conversion.
sourceimpl From<String> for CalculatorFloat
impl From<String> for CalculatorFloat
sourcepub fn from(item: String) -> CalculatorFloat
pub fn from(item: String) -> CalculatorFloat
Performs the conversion.
sourceimpl From<f64> for CalculatorFloat
impl From<f64> for CalculatorFloat
sourcepub fn from(item: f64) -> CalculatorFloat
pub fn from(item: f64) -> CalculatorFloat
Performs the conversion.
sourceimpl From<i32> for CalculatorFloat
impl From<i32> for CalculatorFloat
sourcepub fn from(item: i32) -> CalculatorFloat
pub fn from(item: i32) -> CalculatorFloat
Performs the conversion.
sourceimpl From<u32> for CalculatorFloat
impl From<u32> for CalculatorFloat
sourcepub fn from(item: u32) -> CalculatorFloat
pub fn from(item: u32) -> CalculatorFloat
Performs the conversion.
sourceimpl<T> Mul<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> Mul<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement *
(multiply) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
type Output = CalculatorFloat
type Output = CalculatorFloat
The resulting type after applying the *
operator.
sourcepub fn mul(self, other: T) -> CalculatorFloat
pub fn mul(self, other: T) -> CalculatorFloat
Performs the *
operation. Read more
sourceimpl<T> MulAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> MulAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement *=
(multiply) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
sourcepub fn mul_assign(&mut self, other: T)
pub fn mul_assign(&mut self, other: T)
Performs the *=
operation. Read more
sourceimpl Neg for CalculatorFloat
impl Neg for CalculatorFloat
Implement minus sign for CalculatorFloat.
type Output = CalculatorFloat
type Output = CalculatorFloat
The resulting type after applying the -
operator.
sourcepub fn neg(self) -> CalculatorFloat
pub fn neg(self) -> CalculatorFloat
Performs the unary -
operation. Read more
sourceimpl PartialEq<CalculatorFloat> for CalculatorFloat
impl PartialEq<CalculatorFloat> for CalculatorFloat
sourcepub fn eq(&self, other: &CalculatorFloat) -> bool
pub fn eq(&self, other: &CalculatorFloat) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &CalculatorFloat) -> bool
pub fn ne(&self, other: &CalculatorFloat) -> bool
This method tests for !=
.
sourceimpl Serialize for CalculatorFloat
impl Serialize for CalculatorFloat
sourcepub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl<T> Sub<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> Sub<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement -
(subtract) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
type Output = CalculatorFloat
type Output = CalculatorFloat
The resulting type after applying the -
operator.
sourcepub fn sub(self, other: T) -> CalculatorFloat
pub fn sub(self, other: T) -> CalculatorFloat
Performs the -
operation. Read more
sourceimpl<T> SubAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
impl<T> SubAssign<T> for CalculatorFloat where
CalculatorFloat: From<T>,
Implement -=
(subtract) for CalculatorFloat and generic type T
.
Arguments
other
- Any type T for which CalculatorFloat::Fromtrait is implemented
sourcepub fn sub_assign(&mut self, other: T)
pub fn sub_assign(&mut self, other: T)
Performs the -=
operation. Read more
sourceimpl Sum<CalculatorFloat> for CalculatorFloat
impl Sum<CalculatorFloat> for CalculatorFloat
Implements summing over an iterator of CalculatorFloat
Arguments
iter
- Any iterator over CalculatorFloat items
sourcepub fn sum<I>(iter: I) -> CalculatorFloat where
I: Iterator<Item = CalculatorFloat>,
pub fn sum<I>(iter: I) -> CalculatorFloat where
I: Iterator<Item = CalculatorFloat>,
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
impl StructuralPartialEq for CalculatorFloat
Auto Trait Implementations
impl RefUnwindSafe for CalculatorFloat
impl Send for CalculatorFloat
impl Sync for CalculatorFloat
impl Unpin for CalculatorFloat
impl UnwindSafe for CalculatorFloat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more