pub struct UnsignedF64(/* private fields */);Expand description
a float that is guaranteed to be positive or zero
Implementations§
Source§impl UnsignedF64
impl UnsignedF64
pub const PI: UnsignedF64
pub const E: UnsignedF64
pub const FRAC_1_PI: UnsignedF64
pub const FRAC_1_SQRT_2: UnsignedF64
pub const FRAC_2_PI: UnsignedF64
pub const FRAC_2_SQRT_PI: UnsignedF64
pub const FRAC_PI_2: UnsignedF64
pub const FRAC_PI_3: UnsignedF64
pub const FRAC_PI_4: UnsignedF64
pub const FRAC_PI_6: UnsignedF64
pub const FRAC_PI_8: UnsignedF64
pub const LN_10: UnsignedF64
pub const LN_2: UnsignedF64
pub const LOG10_E: UnsignedF64
pub const LOG2_E: UnsignedF64
pub const SQRT_2: UnsignedF64
pub const TAU: UnsignedF64
pub const EPSILON: UnsignedF64
pub const INFINITY: UnsignedF64
pub const ZERO: UnsignedF64
pub const ONE: UnsignedF64
Sourcepub fn new(value: f64) -> Option<UnsignedF64>
pub fn new(value: f64) -> Option<UnsignedF64>
Creates a new UnsignedF64 if the value is positive or zero. Returns None if the value is negative. Note: This converts -0.0 to 0.0 as -0.0 can introduce negative values in some operations that are otherwise safe.
pub fn square(f: f64) -> UnsignedF64
pub fn floor(&self) -> UnsignedF64
pub fn ceil(&self) -> UnsignedF64
pub fn round(&self) -> UnsignedF64
pub fn trunc(&self) -> UnsignedF64
pub fn fract(&self) -> UnsignedF64
pub fn abs(&self) -> UnsignedF64
Sourcepub fn signum(&self) -> f64
pub fn signum(&self) -> f64
This can return -1 in the case of -0.0. -0.0 is valid for UnsignedF64 since its zero, but signum considers it negative.
Sourcepub fn copysign(&self, sign: f64) -> f64
pub fn copysign(&self, sign: f64) -> f64
This can return a negative if sign is -0.0. -0.0 is valid for UnsignedF64 since its zero, but copysign considers it negative.
pub fn mul_add(&self, a: UnsignedF64, b: UnsignedF64) -> UnsignedF64
pub fn rem_euclid(&self, rhs: UnsignedF64) -> UnsignedF64
pub fn powi(&self, n: i32) -> UnsignedF64
pub fn powf(&self, n: f64) -> UnsignedF64
Sourcepub fn sqrt(&self) -> UnsignedF64
pub fn sqrt(&self) -> UnsignedF64
This should not return NaN.
pub fn exp(&self) -> UnsignedF64
pub fn exp2(&self) -> UnsignedF64
pub fn ln(&self) -> f64
pub fn log(&self, base: f64) -> f64
pub fn log2(&self) -> f64
pub fn log10(&self) -> f64
pub fn cbrt(&self) -> UnsignedF64
pub fn hypot(&self, other: f64) -> UnsignedF64
pub fn sin(&self) -> f64
pub fn cos(&self) -> f64
pub fn tan(&self) -> f64
pub fn asin(&self) -> UnsignedF64
pub fn acos(&self) -> UnsignedF64
pub fn atan(&self) -> UnsignedF64
pub fn sin_cos(&self) -> (f64, f64)
pub fn exp_m1(&self) -> UnsignedF64
pub fn ln_1p(&self) -> UnsignedF64
pub fn sinh(&self) -> UnsignedF64
pub fn cosh(&self) -> UnsignedF64
pub fn tanh(&self) -> UnsignedF64
pub fn asinh(&self) -> UnsignedF64
pub fn acosh(&self) -> UnsignedF64
pub fn atanh(&self) -> UnsignedF64
pub fn is_nan(&self) -> bool
pub fn is_infinite(&self) -> bool
pub fn is_finite(&self) -> bool
pub fn is_subnormal(&self) -> bool
pub fn is_normal(&self) -> bool
pub fn classify(&self) -> FpCategory
Sourcepub fn is_sign_positive(&self) -> bool
pub fn is_sign_positive(&self) -> bool
this may be false if the value is -0.0
Sourcepub fn is_sign_negative(&self) -> bool
pub fn is_sign_negative(&self) -> bool
this may be true if the value is -0.0
pub fn recip(&self) -> UnsignedF64
pub fn to_degrees(&self) -> UnsignedF64
pub fn to_radians(&self) -> UnsignedF64
pub fn max(self, other: UnsignedF64) -> UnsignedF64
pub fn min(self, other: UnsignedF64) -> UnsignedF64
pub fn total_cmp(&self, other: &UnsignedF64) -> Ordering
pub fn clamp(self, min: UnsignedF64, max: UnsignedF64) -> UnsignedF64
Sourcepub unsafe fn from_f64_unchecked(value: f64) -> UnsignedF64
pub unsafe fn from_f64_unchecked(value: f64) -> UnsignedF64
Performs no checking. Useful in scenarios where you know the value is positive and you want to avoid the overhead of checking.
§Safety
The value must be positive or zero.
Trait Implementations§
Source§impl Add<f64> for UnsignedF64
impl Add<f64> for UnsignedF64
Source§impl Add for UnsignedF64
impl Add for UnsignedF64
Source§type Output = UnsignedF64
type Output = UnsignedF64
+ operator.Source§fn add(self, other: UnsignedF64) -> UnsignedF64
fn add(self, other: UnsignedF64) -> UnsignedF64
+ operation. Read moreSource§impl AddAssign for UnsignedF64
impl AddAssign for UnsignedF64
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl AsMut<f64> for UnsignedF64
impl AsMut<f64> for UnsignedF64
Source§impl AsRef<f64> for UnsignedF64
impl AsRef<f64> for UnsignedF64
Source§impl Clone for UnsignedF64
impl Clone for UnsignedF64
Source§fn clone(&self) -> UnsignedF64
fn clone(&self) -> UnsignedF64
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UnsignedF64
impl Debug for UnsignedF64
Source§impl Default for UnsignedF64
impl Default for UnsignedF64
Source§fn default() -> UnsignedF64
fn default() -> UnsignedF64
Source§impl Display for UnsignedF64
impl Display for UnsignedF64
Source§impl Div<f64> for UnsignedF64
impl Div<f64> for UnsignedF64
Source§impl Div for UnsignedF64
impl Div for UnsignedF64
Source§impl DivAssign for UnsignedF64
impl DivAssign for UnsignedF64
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl From<UnsignedF64> for f64
impl From<UnsignedF64> for f64
Source§fn from(value: UnsignedF64) -> f64
fn from(value: UnsignedF64) -> f64
Source§impl Mul<f64> for UnsignedF64
impl Mul<f64> for UnsignedF64
Source§impl Mul for UnsignedF64
impl Mul for UnsignedF64
Source§impl MulAssign for UnsignedF64
impl MulAssign for UnsignedF64
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read more