Trait std::num::Float
[−]
[src]
pub trait Float {
fn nan() -> Self;
fn infinity() -> Self;
fn neg_infinity() -> Self;
fn neg_zero() -> Self;
fn zero() -> Self;
fn one() -> Self;
fn is_nan(self) -> bool;
fn is_infinite(self) -> bool;
fn is_finite(self) -> bool;
fn is_normal(self) -> bool;
fn classify(self) -> FpCategory;
fn integer_decode(self) -> (u64, i16, i8);
fn abs(self) -> Self;
fn signum(self) -> Self;
fn is_sign_positive(self) -> bool;
fn is_sign_negative(self) -> bool;
fn recip(self) -> Self;
fn powi(self, n: i32) -> Self;
fn to_degrees(self) -> Self;
fn to_radians(self) -> Self;
}core_float): stable interface is via impl f{32,64} in later crates
A built-in floating point number.
Required Methods
fn nan() -> Self
float_extras): needs removal
Returns the NaN value.
fn infinity() -> Self
float_extras): needs removal
Returns the infinite value.
fn neg_infinity() -> Self
float_extras): needs removal
Returns the negative infinite value.
fn neg_zero() -> Self
float_extras): needs removal
Returns -0.0.
fn zero() -> Self
float_extras): needs removal
Returns 0.0.
fn one() -> Self
float_extras): needs removal
Returns 1.0.
fn is_nan(self) -> bool
Returns true if this value is NaN and false otherwise.
fn is_infinite(self) -> bool
Returns true if this value is positive infinity or negative infinity and false otherwise.
fn is_finite(self) -> bool
Returns true if this number is neither infinite nor NaN.
fn is_normal(self) -> bool
Returns true if this number is neither zero, infinite, denormal, or NaN.
fn classify(self) -> FpCategory
Returns the category that this number falls into.
fn integer_decode(self) -> (u64, i16, i8)
float_extras): signature is undecided
Returns the mantissa, exponent and sign as integers, respectively.
fn abs(self) -> Self
Computes the absolute value of self. Returns Float::nan() if the
number is Float::nan().
fn signum(self) -> Self
Returns a number that represents the sign of self.
1.0if the number is positive,+0.0orFloat::infinity()-1.0if the number is negative,-0.0orFloat::neg_infinity()Float::nan()if the number isFloat::nan()
fn is_sign_positive(self) -> bool
Returns true if self is positive, including +0.0 and
Float::infinity().
fn is_sign_negative(self) -> bool
Returns true if self is negative, including -0.0 and
Float::neg_infinity().
fn recip(self) -> Self
Take the reciprocal (inverse) of a number, 1/x.
fn powi(self, n: i32) -> Self
Raise a number to an integer power.
Using this function is generally faster than using powf
fn to_degrees(self) -> Self
float_extras): desirability is unclear
Convert radians to degrees.
fn to_radians(self) -> Self
float_extras): desirability is unclear
Convert degrees to radians.