Primitive Type f32
Operations and constants for 32-bits floats (f32 type)
Trait Implementations
impl Float for f32
fn nan() -> f32
fn infinity() -> f32
fn neg_infinity() -> f32
fn neg_zero() -> f32
fn is_nan(self) -> bool
Returns true if the number is NaN
fn is_infinite(self) -> bool
Returns true if the number is infinite
fn is_finite(self) -> bool
Returns true if the number is neither infinite or NaN
fn is_normal(self) -> bool
Returns true if the number is neither zero, infinite, subnormal or NaN
fn classify(self) -> FPCategory
Returns the floating point category of the number. If only one property is going to be tested, it is generally faster to use the specific predicate instead.
fn mantissa_digits(_: Option<f32>) -> uint
fn digits(_: Option<f32>) -> uint
fn epsilon() -> f32
fn min_exp(_: Option<f32>) -> int
fn max_exp(_: Option<f32>) -> int
fn min_10_exp(_: Option<f32>) -> int
fn max_10_exp(_: Option<f32>) -> int
fn min_pos_value(_: Option<f32>) -> f32
fn integer_decode(self) -> (u64, i16, i8)
Returns the mantissa, exponent and sign as integers.
fn floor(self) -> f32
Round half-way cases toward NEG_INFINITY
fn ceil(self) -> f32
Round half-way cases toward INFINITY
fn round(self) -> f32
Round half-way cases away from 0.0
fn trunc(self) -> f32
The integer part of the number (rounds towards 0.0)
fn fract(self) -> f32
The fractional part of the number, satisfying:
fn main() { let x = 1.65f32; assert!(x == x.trunc() + x.fract()) }let x = 1.65f32; assert!(x == x.trunc() + x.fract())
fn mul_add(self, a: f32, b: f32) -> f32
Fused multiply-add. Computes (self * a) + b with only one rounding
error. This produces a more accurate result with better performance than
a separate multiplication operation followed by an add.
fn recip(self) -> f32
The reciprocal (multiplicative inverse) of the number
fn powi(self, n: i32) -> f32
fn powf(self, n: f32) -> f32
fn sqrt2() -> f32
sqrt(2.0)
fn frac_1_sqrt2() -> f32
1.0 / sqrt(2.0)
fn sqrt(self) -> f32
fn rsqrt(self) -> f32
fn pi() -> f32
Archimedes' constant
fn two_pi() -> f32
2.0 * pi
fn frac_pi_2() -> f32
pi / 2.0
fn frac_pi_3() -> f32
pi / 3.0
fn frac_pi_4() -> f32
pi / 4.0
fn frac_pi_6() -> f32
pi / 6.0
fn frac_pi_8() -> f32
pi / 8.0
fn frac_1_pi() -> f32
1 .0/ pi
fn frac_2_pi() -> f32
2.0 / pi
fn frac_2_sqrtpi() -> f32
2.0 / sqrt(pi)
fn e() -> f32
Euler's number
fn log2_e() -> f32
log2(e)
fn log10_e() -> f32
log10(e)
fn ln_2() -> f32
ln(2.0)
fn ln_10() -> f32
ln(10.0)
fn exp(self) -> f32
Returns the exponential of the number
fn exp2(self) -> f32
Returns 2 raised to the power of the number
fn ln(self) -> f32
Returns the natural logarithm of the number
fn log(self, base: f32) -> f32
Returns the logarithm of the number with respect to an arbitrary base
fn log2(self) -> f32
Returns the base 2 logarithm of the number
fn log10(self) -> f32
Returns the base 10 logarithm of the number
fn to_degrees(self) -> f32
Converts to degrees, assuming the number is in radians
fn to_radians(self) -> f32
Converts to radians, assuming the number is in degrees
impl Num for f32
impl Zero for f32
impl One for f32
impl Signed for f32
fn abs(&self) -> f32
Computes the absolute value. Returns NAN if the number is NAN.
fn abs_sub(&self, other: &f32) -> f32
The positive difference of two numbers. Returns 0.0 if the number is
less than or equal to other, otherwise the difference betweenself
and other is returned.
fn signum(&self) -> f32
Returns
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number is NaN
fn is_positive(&self) -> bool
Returns true if the number is positive, including +0.0 and INFINITY
fn is_negative(&self) -> bool
Returns true if the number is negative, including -0.0 and NEG_INFINITY