Skip to main content

Float

Trait Float 

Source
pub trait Float:
    Copy
    + Default
    + Display
    + FromStr
    + PartialEq
    + PartialOrd
    + Zero
    + One
    + Bounded
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + Neg<Output = Self>
    + Rem<Output = Self> {
Show 31 associated constants and 55 methods const RADIX: u32; const MANTISSA_DIGITS: u32; const DIGITS: u32; const EPSILON: Self; const MIN: Self; const MIN_POSITIVE: Self; const MAX: Self; const MIN_EXP: i32; const MAX_EXP: i32; const MIN_10_EXP: i32; const MAX_10_EXP: i32; const NAN: Self; const INFINITY: Self; const NEG_INFINITY: Self; const PI: Self; const TAU: 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 FRAC_1_PI: Self; const FRAC_2_PI: Self; const FRAC_2_SQRT_PI: Self; const SQRT_2: Self; const FRAC_1_SQRT_2: Self; const E: Self; const LOG2_E: Self; const LOG10_E: Self; const LN_2: Self; const LN_10: Self; // Required methods fn floor(self) -> Self; fn ceil(self) -> Self; fn round(self) -> Self; fn trunc(self) -> Self; fn fract(self) -> Self; fn abs(self) -> Self; fn signum(self) -> Self; fn copysign(self, sign: Self) -> Self; fn mul_add(self, a: Self, b: Self) -> Self; fn div_euclid(self, rhs: Self) -> Self; fn rem_euclid(self, rhs: Self) -> Self; fn powi(self, n: i32) -> Self; fn powf(self, n: Self) -> Self; fn sqrt(self) -> Self; fn exp(self) -> Self; fn exp2(self) -> Self; fn ln(self) -> Self; fn log(self, base: Self) -> Self; fn log2(self) -> Self; fn log10(self) -> Self; fn cbrt(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 exp_m1(self) -> Self; fn ln_1p(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; 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 is_sign_positive(self) -> bool; fn is_sign_negative(self) -> bool; fn recip(self) -> Self; fn to_degrees(self) -> Self; fn to_radians(self) -> Self; fn max(self, other: Self) -> Self; fn min(self, other: Self) -> Self; fn midpoint(self, other: Self) -> Self; fn to_bits(self) -> u64; fn from_bits(v: u64) -> Self; fn total_cmp(&self, other: &Self) -> Ordering; fn clamp(self, min: Self, max: Self) -> Self;
}

Required Associated Constants§

Source

const RADIX: u32

Source

const MANTISSA_DIGITS: u32

Source

const DIGITS: u32

Source

const EPSILON: Self

Source

const MIN: Self

Source

const MIN_POSITIVE: Self

Source

const MAX: Self

Source

const MIN_EXP: i32

Source

const MAX_EXP: i32

Source

const MIN_10_EXP: i32

Source

const MAX_10_EXP: i32

Source

const NAN: Self

Source

const INFINITY: Self

Source

const NEG_INFINITY: Self

Source

const PI: Self

Source

const TAU: Self

Source

const FRAC_PI_2: Self

Source

const FRAC_PI_3: Self

Source

const FRAC_PI_4: Self

Source

const FRAC_PI_6: Self

Source

const FRAC_PI_8: Self

Source

const FRAC_1_PI: Self

Source

const FRAC_2_PI: Self

Source

const FRAC_2_SQRT_PI: Self

Source

const SQRT_2: Self

Source

const FRAC_1_SQRT_2: Self

Source

const E: Self

Source

const LOG2_E: Self

Source

const LOG10_E: Self

Source

const LN_2: Self

Source

const LN_10: Self

Required Methods§

Source

fn floor(self) -> Self

Source

fn ceil(self) -> Self

Source

fn round(self) -> Self

Source

fn trunc(self) -> Self

Source

fn fract(self) -> Self

Source

fn abs(self) -> Self

Source

fn signum(self) -> Self

Source

fn copysign(self, sign: Self) -> Self

Source

fn mul_add(self, a: Self, b: Self) -> Self

Source

fn div_euclid(self, rhs: Self) -> Self

Source

fn rem_euclid(self, rhs: Self) -> Self

Source

fn powi(self, n: i32) -> Self

Source

fn powf(self, n: Self) -> Self

Source

fn sqrt(self) -> Self

Source

fn exp(self) -> Self

Source

fn exp2(self) -> Self

Source

fn ln(self) -> Self

Source

fn log(self, base: Self) -> Self

Source

fn log2(self) -> Self

Source

fn log10(self) -> Self

Source

fn cbrt(self) -> Self

Source

fn hypot(self, other: Self) -> Self

Source

fn sin(self) -> Self

Source

fn cos(self) -> Self

Source

fn tan(self) -> Self

Source

fn asin(self) -> Self

Source

fn acos(self) -> Self

Source

fn atan(self) -> Self

Source

fn atan2(self, other: Self) -> Self

Source

fn sin_cos(self) -> (Self, Self)

Source

fn exp_m1(self) -> Self

Source

fn ln_1p(self) -> Self

Source

fn sinh(self) -> Self

Source

fn cosh(self) -> Self

Source

fn tanh(self) -> Self

Source

fn asinh(self) -> Self

Source

fn acosh(self) -> Self

Source

fn atanh(self) -> Self

Source

fn is_nan(self) -> bool

Source

fn is_infinite(self) -> bool

Source

fn is_finite(self) -> bool

Source

fn is_normal(self) -> bool

Source

fn classify(self) -> FpCategory

Source

fn is_sign_positive(self) -> bool

Source

fn is_sign_negative(self) -> bool

Source

fn recip(self) -> Self

Source

fn to_degrees(self) -> Self

Source

fn to_radians(self) -> Self

Source

fn max(self, other: Self) -> Self

Source

fn min(self, other: Self) -> Self

Source

fn midpoint(self, other: Self) -> Self

Source

fn to_bits(self) -> u64

Source

fn from_bits(v: u64) -> Self

Source

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

Source

fn clamp(self, min: Self, max: Self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

const RADIX: u32 = f32::RADIX

Source§

const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS

Source§

const DIGITS: u32 = f32::DIGITS

Source§

const EPSILON: Self = f32::EPSILON

Source§

const MIN: Self = f32::MIN

Source§

const MIN_POSITIVE: Self = f32::MIN_POSITIVE

Source§

const MAX: Self = f32::MAX

Source§

const MIN_EXP: i32 = f32::MIN_EXP

Source§

const MAX_EXP: i32 = f32::MAX_EXP

Source§

const MIN_10_EXP: i32 = f32::MIN_10_EXP

Source§

const MAX_10_EXP: i32 = f32::MAX_10_EXP

Source§

const NAN: Self = f32::NAN

Source§

const INFINITY: Self = f32::INFINITY

Source§

const NEG_INFINITY: Self = f32::NEG_INFINITY

Source§

const PI: Self = std::f32::consts::PI

Source§

const TAU: Self

Source§

const FRAC_PI_2: Self = std::f32::consts::FRAC_PI_2

Source§

const FRAC_PI_3: Self = std::f32::consts::FRAC_PI_3

Source§

const FRAC_PI_4: Self = std::f32::consts::FRAC_PI_4

Source§

const FRAC_PI_6: Self = std::f32::consts::FRAC_PI_6

Source§

const FRAC_PI_8: Self = std::f32::consts::FRAC_PI_8

Source§

const FRAC_1_PI: Self = std::f32::consts::FRAC_1_PI

Source§

const FRAC_2_PI: Self = std::f32::consts::FRAC_2_PI

Source§

const FRAC_2_SQRT_PI: Self = std::f32::consts::FRAC_2_SQRT_PI

Source§

const SQRT_2: Self = std::f32::consts::SQRT_2

Source§

const FRAC_1_SQRT_2: Self = std::f32::consts::FRAC_1_SQRT_2

Source§

const E: Self = std::f32::consts::E

Source§

const LOG2_E: Self = std::f32::consts::LOG2_E

Source§

const LOG10_E: Self = std::f32::consts::LOG10_E

Source§

const LN_2: Self = std::f32::consts::LN_2

Source§

const LN_10: Self = std::f32::consts::LN_10

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn copysign(self, sign: Self) -> Self

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn div_euclid(self, rhs: Self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn powi(self, n: i32) -> Self

Source§

fn powf(self, n: Self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn log(self, base: Self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn hypot(self, other: Self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn atan2(self, other: Self) -> Self

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn exp_m1(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn is_normal(self) -> bool

Source§

fn classify(self) -> FpCategory

Source§

fn is_sign_positive(self) -> bool

Source§

fn is_sign_negative(self) -> bool

Source§

fn recip(self) -> Self

Source§

fn to_degrees(self) -> Self

Source§

fn to_radians(self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn min(self, other: Self) -> Self

Source§

fn midpoint(self, other: Self) -> Self

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(v: u64) -> Self

Source§

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

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl Float for f64

Source§

const RADIX: u32 = f64::RADIX

Source§

const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS

Source§

const DIGITS: u32 = f64::DIGITS

Source§

const EPSILON: Self = f64::EPSILON

Source§

const MIN: Self = f64::MIN

Source§

const MIN_POSITIVE: Self = f64::MIN_POSITIVE

Source§

const MAX: Self = f64::MAX

Source§

const MIN_EXP: i32 = f64::MIN_EXP

Source§

const MAX_EXP: i32 = f64::MAX_EXP

Source§

const MIN_10_EXP: i32 = f64::MIN_10_EXP

Source§

const MAX_10_EXP: i32 = f64::MAX_10_EXP

Source§

const NAN: Self = f64::NAN

Source§

const INFINITY: Self = f64::INFINITY

Source§

const NEG_INFINITY: Self = f64::NEG_INFINITY

Source§

const PI: Self = std::f64::consts::PI

Source§

const TAU: Self

Source§

const FRAC_PI_2: Self = std::f64::consts::FRAC_PI_2

Source§

const FRAC_PI_3: Self = std::f64::consts::FRAC_PI_3

Source§

const FRAC_PI_4: Self = std::f64::consts::FRAC_PI_4

Source§

const FRAC_PI_6: Self = std::f64::consts::FRAC_PI_6

Source§

const FRAC_PI_8: Self = std::f64::consts::FRAC_PI_8

Source§

const FRAC_1_PI: Self = std::f64::consts::FRAC_1_PI

Source§

const FRAC_2_PI: Self = std::f64::consts::FRAC_2_PI

Source§

const FRAC_2_SQRT_PI: Self = std::f64::consts::FRAC_2_SQRT_PI

Source§

const SQRT_2: Self = std::f64::consts::SQRT_2

Source§

const FRAC_1_SQRT_2: Self = std::f64::consts::FRAC_1_SQRT_2

Source§

const E: Self = std::f64::consts::E

Source§

const LOG2_E: Self = std::f64::consts::LOG2_E

Source§

const LOG10_E: Self = std::f64::consts::LOG10_E

Source§

const LN_2: Self = std::f64::consts::LN_2

Source§

const LN_10: Self = std::f64::consts::LN_10

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn copysign(self, sign: Self) -> Self

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn div_euclid(self, rhs: Self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn powi(self, n: i32) -> Self

Source§

fn powf(self, n: Self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn log(self, base: Self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn hypot(self, other: Self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn atan2(self, other: Self) -> Self

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn exp_m1(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn is_normal(self) -> bool

Source§

fn classify(self) -> FpCategory

Source§

fn is_sign_positive(self) -> bool

Source§

fn is_sign_negative(self) -> bool

Source§

fn recip(self) -> Self

Source§

fn to_degrees(self) -> Self

Source§

fn to_radians(self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn min(self, other: Self) -> Self

Source§

fn midpoint(self, other: Self) -> Self

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(v: u64) -> Self

Source§

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

Source§

fn clamp(self, min: Self, max: Self) -> Self

Implementors§

Source§

impl Float for Float32

Source§

const RADIX: u32 = <f32 as Float>::RADIX

Source§

const MANTISSA_DIGITS: u32 = <f32 as Float>::MANTISSA_DIGITS

Source§

const DIGITS: u32 = <f32 as Float>::DIGITS

Source§

const EPSILON: Self

Source§

const MIN: Self

Source§

const MIN_POSITIVE: Self

Source§

const MAX: Self

Source§

const MIN_EXP: i32 = <f32 as Float>::MIN_EXP

Source§

const MAX_EXP: i32 = <f32 as Float>::MAX_EXP

Source§

const MIN_10_EXP: i32 = <f32 as Float>::MIN_10_EXP

Source§

const MAX_10_EXP: i32 = <f32 as Float>::MAX_10_EXP

Source§

const NAN: Self

Source§

const INFINITY: Self

Source§

const NEG_INFINITY: Self

Source§

const PI: Self

Source§

const TAU: Self

Source§

const FRAC_PI_2: Self

Source§

const FRAC_PI_3: Self

Source§

const FRAC_PI_4: Self

Source§

const FRAC_PI_6: Self

Source§

const FRAC_PI_8: Self

Source§

const FRAC_1_PI: Self

Source§

const FRAC_2_PI: Self

Source§

const FRAC_2_SQRT_PI: Self

Source§

const SQRT_2: Self

Source§

const FRAC_1_SQRT_2: Self

Source§

const E: Self

Source§

const LOG2_E: Self

Source§

const LOG10_E: Self

Source§

const LN_2: Self

Source§

const LN_10: Self

Source§

impl Float for Float64

Source§

const RADIX: u32 = <f64 as Float>::RADIX

Source§

const MANTISSA_DIGITS: u32 = <f64 as Float>::MANTISSA_DIGITS

Source§

const DIGITS: u32 = <f64 as Float>::DIGITS

Source§

const EPSILON: Self

Source§

const MIN: Self

Source§

const MIN_POSITIVE: Self

Source§

const MAX: Self

Source§

const MIN_EXP: i32 = <f64 as Float>::MIN_EXP

Source§

const MAX_EXP: i32 = <f64 as Float>::MAX_EXP

Source§

const MIN_10_EXP: i32 = <f64 as Float>::MIN_10_EXP

Source§

const MAX_10_EXP: i32 = <f64 as Float>::MAX_10_EXP

Source§

const NAN: Self

Source§

const INFINITY: Self

Source§

const NEG_INFINITY: Self

Source§

const PI: Self

Source§

const TAU: Self

Source§

const FRAC_PI_2: Self

Source§

const FRAC_PI_3: Self

Source§

const FRAC_PI_4: Self

Source§

const FRAC_PI_6: Self

Source§

const FRAC_PI_8: Self

Source§

const FRAC_1_PI: Self

Source§

const FRAC_2_PI: Self

Source§

const FRAC_2_SQRT_PI: Self

Source§

const SQRT_2: Self

Source§

const FRAC_1_SQRT_2: Self

Source§

const E: Self

Source§

const LOG2_E: Self

Source§

const LOG10_E: Self

Source§

const LN_2: Self

Source§

const LN_10: Self