UnsignedF64

Struct UnsignedF64 

Source
pub struct UnsignedF64(/* private fields */);
Expand description

a float that is guaranteed to be positive or zero

Implementations§

Source§

impl UnsignedF64

Source

pub const PI: UnsignedF64

Source

pub const E: UnsignedF64

Source

pub const FRAC_1_PI: UnsignedF64

Source

pub const FRAC_1_SQRT_2: UnsignedF64

Source

pub const FRAC_2_PI: UnsignedF64

Source

pub const FRAC_2_SQRT_PI: UnsignedF64

Source

pub const FRAC_PI_2: UnsignedF64

Source

pub const FRAC_PI_3: UnsignedF64

Source

pub const FRAC_PI_4: UnsignedF64

Source

pub const FRAC_PI_6: UnsignedF64

Source

pub const FRAC_PI_8: UnsignedF64

Source

pub const LN_10: UnsignedF64

Source

pub const LN_2: UnsignedF64

Source

pub const LOG10_E: UnsignedF64

Source

pub const LOG2_E: UnsignedF64

Source

pub const SQRT_2: UnsignedF64

Source

pub const TAU: UnsignedF64

Source

pub const EPSILON: UnsignedF64

Source

pub const INFINITY: UnsignedF64

Source

pub const ZERO: UnsignedF64

Source

pub const ONE: UnsignedF64

Source

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.

Source

pub fn square(f: f64) -> UnsignedF64

Source

pub fn floor(&self) -> UnsignedF64

Source

pub fn ceil(&self) -> UnsignedF64

Source

pub fn round(&self) -> UnsignedF64

Source

pub fn trunc(&self) -> UnsignedF64

Source

pub fn fract(&self) -> UnsignedF64

Source

pub fn abs(&self) -> UnsignedF64

Source

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.

Source

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.

Source

pub fn mul_add(&self, a: UnsignedF64, b: UnsignedF64) -> UnsignedF64

Source

pub fn rem_euclid(&self, rhs: UnsignedF64) -> UnsignedF64

Source

pub fn powi(&self, n: i32) -> UnsignedF64

Source

pub fn powf(&self, n: f64) -> UnsignedF64

Source

pub fn sqrt(&self) -> UnsignedF64

This should not return NaN.

Source

pub fn exp(&self) -> UnsignedF64

Source

pub fn exp2(&self) -> UnsignedF64

Source

pub fn ln(&self) -> f64

Source

pub fn log(&self, base: f64) -> f64

Source

pub fn log2(&self) -> f64

Source

pub fn log10(&self) -> f64

Source

pub fn cbrt(&self) -> UnsignedF64

Source

pub fn hypot(&self, other: f64) -> UnsignedF64

Source

pub fn sin(&self) -> f64

Source

pub fn cos(&self) -> f64

Source

pub fn tan(&self) -> f64

Source

pub fn asin(&self) -> UnsignedF64

Source

pub fn acos(&self) -> UnsignedF64

Source

pub fn atan(&self) -> UnsignedF64

Source

pub fn sin_cos(&self) -> (f64, f64)

Source

pub fn exp_m1(&self) -> UnsignedF64

Source

pub fn ln_1p(&self) -> UnsignedF64

Source

pub fn sinh(&self) -> UnsignedF64

Source

pub fn cosh(&self) -> UnsignedF64

Source

pub fn tanh(&self) -> UnsignedF64

Source

pub fn asinh(&self) -> UnsignedF64

Source

pub fn acosh(&self) -> UnsignedF64

Source

pub fn atanh(&self) -> UnsignedF64

Source

pub fn is_nan(&self) -> bool

Source

pub fn is_infinite(&self) -> bool

Source

pub fn is_finite(&self) -> bool

Source

pub fn is_subnormal(&self) -> bool

Source

pub fn is_normal(&self) -> bool

Source

pub fn classify(&self) -> FpCategory

Source

pub fn is_sign_positive(&self) -> bool

this may be false if the value is -0.0

Source

pub fn is_sign_negative(&self) -> bool

this may be true if the value is -0.0

Source

pub fn recip(&self) -> UnsignedF64

Source

pub fn to_degrees(&self) -> UnsignedF64

Source

pub fn to_radians(&self) -> UnsignedF64

Source

pub fn max(self, other: UnsignedF64) -> UnsignedF64

Source

pub fn min(self, other: UnsignedF64) -> UnsignedF64

Source

pub fn total_cmp(&self, other: &UnsignedF64) -> Ordering

Source

pub fn clamp(self, min: UnsignedF64, max: UnsignedF64) -> UnsignedF64

Source

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

Source§

type Output = f64

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for UnsignedF64

Source§

type Output = UnsignedF64

The resulting type after applying the + operator.
Source§

fn add(self, other: UnsignedF64) -> UnsignedF64

Performs the + operation. Read more
Source§

impl AddAssign for UnsignedF64

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl AsMut<f64> for UnsignedF64

Source§

fn as_mut(&mut self) -> &mut f64

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<f64> for UnsignedF64

Source§

fn as_ref(&self) -> &f64

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for UnsignedF64

Source§

fn clone(&self) -> UnsignedF64

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnsignedF64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for UnsignedF64

Source§

fn default() -> UnsignedF64

Returns the “default value” for a type. Read more
Source§

impl Display for UnsignedF64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<f64> for UnsignedF64

Source§

type Output = f64

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for UnsignedF64

Source§

type Output = UnsignedF64

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign for UnsignedF64

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl From<UnsignedF64> for f64

Source§

fn from(value: UnsignedF64) -> f64

Converts to this type from the input type.
Source§

impl Mul<f64> for UnsignedF64

Source§

type Output = f64

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for UnsignedF64

Source§

type Output = UnsignedF64

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign for UnsignedF64

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for UnsignedF64

Source§

type Output = f64

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl PartialEq<f64> for UnsignedF64

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for UnsignedF64

Source§

fn eq(&self, other: &UnsignedF64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<f64> for UnsignedF64

Source§

fn partial_cmp(&self, other: &f64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for UnsignedF64

Source§

fn partial_cmp(&self, other: &UnsignedF64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub<f64> for UnsignedF64

Source§

type Output = f64

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for UnsignedF64

Source§

type Output = f64

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl TryFrom<f64> for UnsignedF64

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(value: f64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for UnsignedF64

Source§

impl StructuralPartialEq for UnsignedF64

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.