pub struct ConstrainedFloat<T, P> { /* private fields */ }Expand description
Floating-point proxy that provides a total ordering, equivalence, hashing, and constraints.
ConstrainedFloat wraps primitive floating-point types and provides
implementations for numeric traits using a total ordering, including Ord,
Eq, and Hash. ConstrainedFloat supports various constraints on the
class of values that may be represented and panics if these constraints are
violated.
This type is re-exported but should not (and cannot) be used directly. Use
the type aliases Total, NotNan, and Finite instead.
§Total Ordering
All proxy types use the following total ordering:
$$-\infin<\cdots<0<\cdots<\infin<\text{NaN}$$
See the cmp module for a description of the total ordering used to
implement Ord and Eq.
§Constraints
Constraints restrict the set of values that a proxy may take by disallowing certain classes or subsets of those values. If a constraint is violated (because a proxy type would need to take a value it disallows), the operation panics.
Constraints may disallow two broad classes of floating-point values:
infinities and NaNs. Constraints are exposed by the Total, NotNan, and
Finite type definitions. Note that Total uses a unit constraint, which
enforces no constraints at all and never panics.
Implementations§
Source§impl<T, P> ConstrainedFloat<T, P>
impl<T, P> ConstrainedFloat<T, P>
Sourcepub fn from_inner(value: T) -> Self
pub fn from_inner(value: T) -> Self
Converts a primitive floating-point value into a proxy.
The same behavior is provided by an implementation of the From trait.
§Panics
This conversion and the implementation of the From trait will panic
if the primitive floating-point value violates the constraints of the
proxy.
§Examples
Converting primitive floating-point values into proxies:
use decorum::R64;
fn f(x: R64) -> R64 {
x * 2.0
}
// Conversion using `from_inner`.
let y = f(R64::from_inner(2.0));
// Conversion using `From`/`Into`.
let z = f(2.0.into());Performing a conversion that panics:
use decorum::R64;
// `R64` does not allow `NaN`s, but `0.0 / 0.0` produces a `NaN`.
let x = R64::from_inner(0.0 / 0.0); // Panics.Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Converts a proxy into a primitive floating-point value.
§Examples
Converting a proxy into a primitive floating-point value:
use decorum::R64;
fn f() -> R64 {
// ...
}
let x: f64 = f().into_inner();Sourcepub fn from_subset<Q>(other: ConstrainedFloat<T, Q>) -> Selfwhere
Q: Constraint<T> + SubsetOf<P>,
pub fn from_subset<Q>(other: ConstrainedFloat<T, Q>) -> Selfwhere
Q: Constraint<T> + SubsetOf<P>,
Converts a proxy into another proxy that is capable of representing a superset of the values that are members of its constraint.
§Examples
Converting between compatible proxy types:
use decorum::{N64, R64};
use num::Zero;
let x = R64::zero();
let y = N64::from_subset(x);Sourcepub fn into_superset<Q>(self) -> ConstrainedFloat<T, Q>where
Q: Constraint<T> + SupersetOf<P>,
pub fn into_superset<Q>(self) -> ConstrainedFloat<T, Q>where
Q: Constraint<T> + SupersetOf<P>,
Converts a proxy into another proxy that is capable of representing a superset of the values that are members of its constraint.
§Examples
Converting between compatible proxy types:
use decorum::{N64, R64};
use num::Zero;
let x = R64::zero();
let y: N64 = x.into_superset();Trait Implementations§
Source§impl<T, P> AbsDiffEq for ConstrainedFloat<T, P>
impl<T, P> AbsDiffEq for ConstrainedFloat<T, P>
Source§type Epsilon = ConstrainedFloat<T, P>
type Epsilon = ConstrainedFloat<T, P>
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
Source§impl<T, P> Add<T> for ConstrainedFloat<T, P>
impl<T, P> Add<T> for ConstrainedFloat<T, P>
Source§impl<T, P> Add for ConstrainedFloat<T, P>
impl<T, P> Add for ConstrainedFloat<T, P>
Source§impl<T, P> AddAssign<T> for ConstrainedFloat<T, P>
impl<T, P> AddAssign<T> for ConstrainedFloat<T, P>
Source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
+= operation. Read moreSource§impl<T, P> AddAssign for ConstrainedFloat<T, P>
impl<T, P> AddAssign for ConstrainedFloat<T, P>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+= operation. Read moreSource§impl<T, P> AsRef<T> for ConstrainedFloat<T, P>
impl<T, P> AsRef<T> for ConstrainedFloat<T, P>
Source§impl<T, P> Bounded for ConstrainedFloat<T, P>
impl<T, P> Bounded for ConstrainedFloat<T, P>
Source§impl<T: Clone, P: Clone> Clone for ConstrainedFloat<T, P>
impl<T: Clone, P: Clone> Clone for ConstrainedFloat<T, P>
Source§fn clone(&self) -> ConstrainedFloat<T, P>
fn clone(&self) -> ConstrainedFloat<T, P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T, P> Default for ConstrainedFloat<T, P>
impl<T, P> Default for ConstrainedFloat<T, P>
Source§impl<'de, T, P> Deserialize<'de> for ConstrainedFloat<T, P>where
T: Deserialize<'de>,
impl<'de, T, P> Deserialize<'de> for ConstrainedFloat<T, P>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T, P> Display for ConstrainedFloat<T, P>
impl<T, P> Display for ConstrainedFloat<T, P>
Source§impl<T, P> Div<T> for ConstrainedFloat<T, P>
impl<T, P> Div<T> for ConstrainedFloat<T, P>
Source§impl<T, P> Div for ConstrainedFloat<T, P>
impl<T, P> Div for ConstrainedFloat<T, P>
Source§impl<T, P> DivAssign<T> for ConstrainedFloat<T, P>
impl<T, P> DivAssign<T> for ConstrainedFloat<T, P>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
/= operation. Read moreSource§impl<T, P> DivAssign for ConstrainedFloat<T, P>
impl<T, P> DivAssign for ConstrainedFloat<T, P>
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/= operation. Read moreSource§impl<T, P> Encoding for ConstrainedFloat<T, P>
impl<T, P> Encoding for ConstrainedFloat<T, P>
const MAX: Self = _
const MIN: Self = _
const MIN_POSITIVE: Self = _
const EPSILON: Self = _
fn classify(self) -> FpCategory
fn is_normal(self) -> bool
fn is_sign_positive(self) -> bool
fn is_sign_negative(self) -> bool
fn integer_decode(self) -> (u64, i16, i8)
Source§impl<T, P> Float for ConstrainedFloat<T, P>where
T: Float + ForeignFloat + IntrinsicOrd + Primitive,
P: Constraint<T> + Member<InfiniteClass> + Member<NanClass>,
impl<T, P> Float for ConstrainedFloat<T, P>where
T: Float + ForeignFloat + IntrinsicOrd + Primitive,
P: Constraint<T> + Member<InfiniteClass> + Member<NanClass>,
Source§fn neg_infinity() -> Self
fn neg_infinity() -> Self
Source§fn is_infinite(self) -> bool
fn is_infinite(self) -> bool
true if this value is positive infinity or negative infinity and
false otherwise. Read moreSource§fn max_value() -> Self
fn max_value() -> Self
Source§fn min_value() -> Self
fn min_value() -> Self
Source§fn min_positive_value() -> Self
fn min_positive_value() -> Self
Source§fn is_sign_positive(self) -> bool
fn is_sign_positive(self) -> bool
Source§fn is_sign_negative(self) -> bool
fn is_sign_negative(self) -> bool
true if self is negative, including -0.0,
Float::neg_infinity(), and -Float::nan(). Read moreSource§fn classify(self) -> FpCategory
fn classify(self) -> FpCategory
Source§fn integer_decode(self) -> (u64, i16, i8)
fn integer_decode(self) -> (u64, i16, i8)
sign * mantissa * 2 ^ exponent. Read moreSource§fn ceil(self) -> Self
fn ceil(self) -> Self
Source§fn round(self) -> Self
fn round(self) -> Self
0.0. Read moreSource§fn mul_add(self, a: Self, b: Self) -> Self
fn mul_add(self, a: Self, b: Self) -> Self
(self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add. Read moreSource§fn exp_m1(self) -> Self
fn exp_m1(self) -> Self
e^(self) - 1 in a way that is accurate even if the
number is close to zero. Read moreSource§fn log(self, base: Self) -> Self
fn log(self, base: Self) -> Self
Source§fn ln_1p(self) -> Self
fn ln_1p(self) -> Self
ln(1+n) (natural logarithm) more accurately than if
the operations were performed separately. Read moreSource§fn hypot(self, other: Self) -> Self
fn hypot(self, other: Self) -> Self
x and y. Read moreSource§fn asin(self) -> Self
fn asin(self) -> Self
Source§fn acos(self) -> Self
fn acos(self) -> Self
Source§fn atan(self) -> Self
fn atan(self) -> Self
Source§fn to_degrees(self) -> Self
fn to_degrees(self) -> Self
Source§fn to_radians(self) -> Self
fn to_radians(self) -> Self
Source§impl<T, P> FloatConst for ConstrainedFloat<T, P>
impl<T, P> FloatConst for ConstrainedFloat<T, P>
Source§fn FRAC_1_SQRT_2() -> Self
fn FRAC_1_SQRT_2() -> Self
1.0 / sqrt(2.0).Source§fn FRAC_2_SQRT_PI() -> Self
fn FRAC_2_SQRT_PI() -> Self
2.0 / sqrt(π).Source§impl<T> From<ConstrainedFloat<T, FiniteConstraint<T>>> for NotNan<T>
impl<T> From<ConstrainedFloat<T, FiniteConstraint<T>>> for NotNan<T>
Source§impl<T> From<ConstrainedFloat<T, FiniteConstraint<T>>> for Total<T>
impl<T> From<ConstrainedFloat<T, FiniteConstraint<T>>> for Total<T>
Source§impl<T> From<ConstrainedFloat<T, NotNanConstraint<T>>> for Total<T>
impl<T> From<ConstrainedFloat<T, NotNanConstraint<T>>> for Total<T>
Source§impl<P> From<ConstrainedFloat<f32, P>> for f32where
P: Constraint<f32>,
impl<P> From<ConstrainedFloat<f32, P>> for f32where
P: Constraint<f32>,
Source§fn from(value: ConstrainedFloat<f32, P>) -> Self
fn from(value: ConstrainedFloat<f32, P>) -> Self
Source§impl<P> From<ConstrainedFloat<f64, P>> for f64where
P: Constraint<f64>,
impl<P> From<ConstrainedFloat<f64, P>> for f64where
P: Constraint<f64>,
Source§fn from(value: ConstrainedFloat<f64, P>) -> Self
fn from(value: ConstrainedFloat<f64, P>) -> Self
Source§impl<T, P> From<T> for ConstrainedFloat<T, P>
impl<T, P> From<T> for ConstrainedFloat<T, P>
Source§impl<T, P> FromPrimitive for ConstrainedFloat<T, P>
impl<T, P> FromPrimitive for ConstrainedFloat<T, P>
Source§fn from_i8(value: i8) -> Option<Self>
fn from_i8(value: i8) -> Option<Self>
i8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u8(value: u8) -> Option<Self>
fn from_u8(value: u8) -> Option<Self>
u8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i16(value: i16) -> Option<Self>
fn from_i16(value: i16) -> Option<Self>
i16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u16(value: u16) -> Option<Self>
fn from_u16(value: u16) -> Option<Self>
u16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i32(value: i32) -> Option<Self>
fn from_i32(value: i32) -> Option<Self>
i32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u32(value: u32) -> Option<Self>
fn from_u32(value: u32) -> Option<Self>
u32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i64(value: i64) -> Option<Self>
fn from_i64(value: i64) -> Option<Self>
i64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u64(value: u64) -> Option<Self>
fn from_u64(value: u64) -> Option<Self>
u64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_isize(value: isize) -> Option<Self>
fn from_isize(value: isize) -> Option<Self>
isize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_usize(value: usize) -> Option<Self>
fn from_usize(value: usize) -> Option<Self>
usize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_f32(value: f32) -> Option<Self>
fn from_f32(value: f32) -> Option<Self>
f32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_f64(value: f64) -> Option<Self>
fn from_f64(value: f64) -> Option<Self>
f64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§impl<T, P> FromStr for ConstrainedFloat<T, P>
impl<T, P> FromStr for ConstrainedFloat<T, P>
Source§impl<T, P> Hash for ConstrainedFloat<T, P>
impl<T, P> Hash for ConstrainedFloat<T, P>
Source§impl<T, P> Infinite for ConstrainedFloat<T, P>
impl<T, P> Infinite for ConstrainedFloat<T, P>
Source§impl<T, P> IntrinsicOrd for ConstrainedFloat<T, P>
impl<T, P> IntrinsicOrd for ConstrainedFloat<T, P>
Source§fn is_undefined(&self) -> bool
fn is_undefined(&self) -> bool
Source§fn min_max_or_undefined(&self, other: &Self) -> (Self, Self)
fn min_max_or_undefined(&self, other: &Self) -> (Self, Self)
fn min_or_undefined(&self, other: &Self) -> Self
fn max_or_undefined(&self, other: &Self) -> Self
Source§impl<T, P> LowerExp for ConstrainedFloat<T, P>
impl<T, P> LowerExp for ConstrainedFloat<T, P>
Source§impl<T, P> Mul<T> for ConstrainedFloat<T, P>
impl<T, P> Mul<T> for ConstrainedFloat<T, P>
Source§impl<T, P> Mul for ConstrainedFloat<T, P>
impl<T, P> Mul for ConstrainedFloat<T, P>
Source§impl<T, P> MulAssign<T> for ConstrainedFloat<T, P>
impl<T, P> MulAssign<T> for ConstrainedFloat<T, P>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
*= operation. Read moreSource§impl<T, P> MulAssign for ConstrainedFloat<T, P>
impl<T, P> MulAssign for ConstrainedFloat<T, P>
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
*= operation. Read moreSource§impl<T, P> Nan for ConstrainedFloat<T, P>
impl<T, P> Nan for ConstrainedFloat<T, P>
Source§impl<T, P> Neg for ConstrainedFloat<T, P>
impl<T, P> Neg for ConstrainedFloat<T, P>
Source§impl<T, P> Num for ConstrainedFloat<T, P>
impl<T, P> Num for ConstrainedFloat<T, P>
type FromStrRadixErr = ()
Source§fn from_str_radix(
source: &str,
radix: u32,
) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix( source: &str, radix: u32, ) -> Result<Self, Self::FromStrRadixErr>
2..=36). Read moreSource§impl<T, P> NumCast for ConstrainedFloat<T, P>
impl<T, P> NumCast for ConstrainedFloat<T, P>
Source§impl<T, P> One for ConstrainedFloat<T, P>
impl<T, P> One for ConstrainedFloat<T, P>
Source§impl<T, P> Ord for ConstrainedFloat<T, P>
impl<T, P> Ord for ConstrainedFloat<T, P>
Source§impl<T, P> PartialEq<T> for ConstrainedFloat<T, P>
impl<T, P> PartialEq<T> for ConstrainedFloat<T, P>
Source§impl<T, P> PartialEq for ConstrainedFloat<T, P>
impl<T, P> PartialEq for ConstrainedFloat<T, P>
Source§impl<T, P> PartialOrd<T> for ConstrainedFloat<T, P>
impl<T, P> PartialOrd<T> for ConstrainedFloat<T, P>
Source§impl<T, P> PartialOrd for ConstrainedFloat<T, P>
impl<T, P> PartialOrd for ConstrainedFloat<T, P>
Source§impl<T, P> Product for ConstrainedFloat<T, P>
impl<T, P> Product for ConstrainedFloat<T, P>
Source§impl<T, P> Real for ConstrainedFloat<T, P>
impl<T, P> Real for ConstrainedFloat<T, P>
const E: Self = _
const PI: Self = _
const FRAC_1_PI: Self = _
const FRAC_2_PI: Self = _
const FRAC_2_SQRT_PI: Self = _
const FRAC_PI_2: Self = _
const FRAC_PI_3: Self = _
const FRAC_PI_4: Self = _
const FRAC_PI_6: Self = _
const FRAC_PI_8: Self = _
const SQRT_2: Self = _
const FRAC_1_SQRT_2: Self = _
const LN_2: Self = _
const LN_10: Self = _
const LOG2_E: Self = _
const LOG10_E: Self = _
fn floor(self) -> Self
fn ceil(self) -> Self
fn round(self) -> Self
fn trunc(self) -> Self
fn fract(self) -> Self
fn recip(self) -> Self
fn mul_add(self, a: Self, b: Self) -> Self
fn powi(self, n: i32) -> Self
fn powf(self, n: Self) -> Self
fn sqrt(self) -> Self
fn cbrt(self) -> Self
fn exp(self) -> Self
fn exp2(self) -> Self
fn exp_m1(self) -> Self
fn log(self, base: Self) -> Self
fn ln(self) -> Self
fn log2(self) -> Self
fn log10(self) -> Self
fn ln_1p(self) -> Self
fn hypot(self, other: Self) -> Self
fn sin(self) -> Self
fn cos(self) -> Self
fn tan(self) -> Self
fn asin(self) -> Self
fn acos(self) -> Self
fn atan(self) -> Self
fn atan2(self, other: Self) -> Self
fn sin_cos(self) -> (Self, Self)
fn sinh(self) -> Self
fn cosh(self) -> Self
fn tanh(self) -> Self
fn asinh(self) -> Self
fn acosh(self) -> Self
fn atanh(self) -> Self
Source§impl<T, P> RelativeEq for ConstrainedFloat<T, P>
impl<T, P> RelativeEq for ConstrainedFloat<T, P>
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
Source§impl<T, P> Rem<T> for ConstrainedFloat<T, P>
impl<T, P> Rem<T> for ConstrainedFloat<T, P>
Source§impl<T, P> Rem for ConstrainedFloat<T, P>
impl<T, P> Rem for ConstrainedFloat<T, P>
Source§impl<T, P> RemAssign<T> for ConstrainedFloat<T, P>
impl<T, P> RemAssign<T> for ConstrainedFloat<T, P>
Source§fn rem_assign(&mut self, other: T)
fn rem_assign(&mut self, other: T)
%= operation. Read moreSource§impl<T, P> RemAssign for ConstrainedFloat<T, P>
impl<T, P> RemAssign for ConstrainedFloat<T, P>
Source§fn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
%= operation. Read moreSource§impl<T, P> Serialize for ConstrainedFloat<T, P>where
T: Serialize,
impl<T, P> Serialize for ConstrainedFloat<T, P>where
T: Serialize,
Source§impl<T, P> Signed for ConstrainedFloat<T, P>
impl<T, P> Signed for ConstrainedFloat<T, P>
Source§fn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Source§fn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Source§impl<T, P> Sub<T> for ConstrainedFloat<T, P>
impl<T, P> Sub<T> for ConstrainedFloat<T, P>
Source§impl<T, P> Sub for ConstrainedFloat<T, P>
impl<T, P> Sub for ConstrainedFloat<T, P>
Source§impl<T, P> SubAssign<T> for ConstrainedFloat<T, P>
impl<T, P> SubAssign<T> for ConstrainedFloat<T, P>
Source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
-= operation. Read moreSource§impl<T, P> SubAssign for ConstrainedFloat<T, P>
impl<T, P> SubAssign for ConstrainedFloat<T, P>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-= operation. Read moreSource§impl<T, P> Sum for ConstrainedFloat<T, P>
impl<T, P> Sum for ConstrainedFloat<T, P>
Source§impl<T, P> ToCanonicalBits for ConstrainedFloat<T, P>
impl<T, P> ToCanonicalBits for ConstrainedFloat<T, P>
Source§fn to_canonical_bits(self) -> u64
fn to_canonical_bits(self) -> u64
Source§impl<T, P> ToPrimitive for ConstrainedFloat<T, P>
impl<T, P> ToPrimitive for ConstrainedFloat<T, P>
Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self to an i8. If the value cannot be
represented by an i8, then None is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self to a u8. If the value cannot be
represented by a u8, then None is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self to an i16. If the value cannot be
represented by an i16, then None is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self to a u16. If the value cannot be
represented by a u16, then None is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self to an i32. If the value cannot be
represented by an i32, then None is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self to a u32. If the value cannot be
represented by a u32, then None is returned.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self to an i64. If the value cannot be
represented by an i64, then None is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self to a u64. If the value cannot be
represented by a u64, then None is returned.Source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self to an isize. If the value cannot be
represented by an isize, then None is returned.Source§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self to a usize. If the value cannot be
represented by a usize, then None is returned.Source§fn to_f32(&self) -> Option<f32>
fn to_f32(&self) -> Option<f32>
self to an f32. Overflows may map to positive
or negative inifinity, otherwise None is returned if the value cannot
be represented by an f32.Source§fn to_f64(&self) -> Option<f64>
fn to_f64(&self) -> Option<f64>
self to an f64. Overflows may map to positive
or negative inifinity, otherwise None is returned if the value cannot
be represented by an f64. Read moreSource§impl<T, P> UlpsEq for ConstrainedFloat<T, P>
impl<T, P> UlpsEq for ConstrainedFloat<T, P>
Source§impl<T, P> UpperExp for ConstrainedFloat<T, P>
impl<T, P> UpperExp for ConstrainedFloat<T, P>
Source§impl<T, P> Zero for ConstrainedFloat<T, P>
impl<T, P> Zero for ConstrainedFloat<T, P>
impl<T: Copy, P: Copy> Copy for ConstrainedFloat<T, P>
impl<T, P> Eq for ConstrainedFloat<T, P>
Auto Trait Implementations§
impl<T, P> Freeze for ConstrainedFloat<T, P>where
T: Freeze,
impl<T, P> RefUnwindSafe for ConstrainedFloat<T, P>where
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for ConstrainedFloat<T, P>
impl<T, P> Sync for ConstrainedFloat<T, P>
impl<T, P> Unpin for ConstrainedFloat<T, P>
impl<T, P> UnwindSafe for ConstrainedFloat<T, P>where
T: UnwindSafe,
P: UnwindSafe,
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)Source§impl<T> LowerBounded for Twhere
T: Bounded,
impl<T> LowerBounded for Twhere
T: Bounded,
Source§impl<T> Real for Twhere
T: Float,
impl<T> Real for Twhere
T: Float,
Source§fn min_positive_value() -> T
fn min_positive_value() -> T
Source§fn round(self) -> T
fn round(self) -> T
0.0. Read moreSource§fn is_sign_positive(self) -> bool
fn is_sign_positive(self) -> bool
true if self is positive, including +0.0,
Float::infinity(), and with newer versions of Rust f64::NAN. Read moreSource§fn is_sign_negative(self) -> bool
fn is_sign_negative(self) -> bool
true if self is negative, including -0.0,
Float::neg_infinity(), and with newer versions of Rust -f64::NAN. Read moreSource§fn mul_add(self, a: T, b: T) -> T
fn mul_add(self, a: T, b: T) -> T
(self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add. Read moreSource§fn log(self, base: T) -> T
fn log(self, base: T) -> T
Source§fn to_degrees(self) -> T
fn to_degrees(self) -> T
Source§fn to_radians(self) -> T
fn to_radians(self) -> T
Source§fn hypot(self, other: T) -> T
fn hypot(self, other: T) -> T
x and y. Read moreSource§fn asin(self) -> T
fn asin(self) -> T
Source§fn acos(self) -> T
fn acos(self) -> T
Source§fn atan(self) -> T
fn atan(self) -> T
Source§fn exp_m1(self) -> T
fn exp_m1(self) -> T
e^(self) - 1 in a way that is accurate even if the
number is close to zero. Read more