pub unsafe trait FloatingPointwhere
Self: Add<Output = Self> + AddAssign + Arithmetic + Div<Output = Self> + DivAssign + Mul<Output = Self> + MulAssign + Neg<Output = Self> + Rem<Output = Self> + RemAssign + Sub<Output = Self> + SubAssign,{
type Bits: Unsigned;
Show 35 associated constants and 23 methods
const DIGITS: u32;
const E: Self;
const EPSILON: Self;
const EULER_GAMMA: Self;
const FRAC_1_PI: Self;
const FRAC_1_SQRT_2: Self;
const FRAC_2_PI: Self;
const FRAC_2_SQRT_PI: 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 GOLDEN_RATIO: Self;
const INFINITY: Self;
const LN_10: Self;
const LN_2: Self;
const LOG10_2: Self;
const LOG10_E: Self;
const LOG2_10: Self;
const LOG2_E: Self;
const MANTISSA_DIGITS: u32;
const MAX: Self;
const MAX_10_EXP: i32;
const MAX_EXP: i32;
const MIN: Self;
const MIN_10_EXP: i32;
const MIN_EXP: i32;
const MIN_POSITIVE: Self;
const NAN: Self;
const NEG_INFINITY: Self;
const PI: Self;
const RADIX: u32;
const SQRT_2: Self;
const TAU: Self;
// Required methods
fn abs(self) -> Self;
fn clamp(self, min: Self, max: Self) -> Self;
fn classify(self) -> FpCategory;
fn copysign(self, rhs: Self) -> Self;
fn from_bits(bits: Self::Bits) -> Self;
fn is_finite(self) -> bool;
fn is_infinite(self) -> bool;
fn is_nan(self) -> bool;
fn is_normal(self) -> bool;
fn is_sign_negative(self) -> bool;
fn is_sign_positive(self) -> bool;
fn is_subnormal(self) -> bool;
fn max(self, rhs: Self) -> Self;
fn midpoint(self, rhs: Self) -> Self;
fn min(self, rhs: Self) -> Self;
fn next_down(self) -> Self;
fn next_up(self) -> Self;
fn recip(self) -> Self;
fn signum(self) -> Self;
fn to_bits(self) -> Self::Bits;
fn to_degrees(self) -> Self;
fn to_radians(self) -> Self;
fn total_cmp(&self, rhs: &Self) -> Ordering;
}Expand description
Required Associated Constants§
Sourceconst DIGITS: u32
const DIGITS: u32
See f64::DIGITS.
Sourceconst E: Self
const E: Self
See f64::consts::E.
Sourceconst EPSILON: Self
const EPSILON: Self
See f64::EPSILON.
Sourceconst EULER_GAMMA: Self
const EULER_GAMMA: Self
Sourceconst FRAC_1_SQRT_2: Self
const FRAC_1_SQRT_2: Self
Sourceconst FRAC_2_SQRT_PI: Self
const FRAC_2_SQRT_PI: Self
Sourceconst GOLDEN_RATIO: Self
const GOLDEN_RATIO: Self
Sourceconst INFINITY: Self
const INFINITY: Self
See f64::INFINITY.
Sourceconst LN_10: Self
const LN_10: Self
See f64::consts::LN_10.
Sourceconst LN_2: Self
const LN_2: Self
See f64::consts::LN_2.
Sourceconst LOG10_2: Self
const LOG10_2: Self
See f64::consts::LOG10_2.
Sourceconst LOG10_E: Self
const LOG10_E: Self
See f64::consts::LOG10_E.
Sourceconst LOG2_10: Self
const LOG2_10: Self
See f64::consts::LOG2_10.
Sourceconst LOG2_E: Self
const LOG2_E: Self
See f64::consts::LOG2_E.
Sourceconst MANTISSA_DIGITS: u32
const MANTISSA_DIGITS: u32
See f64::MANTISSA_DIGITS.
Sourceconst MAX_10_EXP: i32
const MAX_10_EXP: i32
See f64::MAX_10_EXP.
Sourceconst MAX_EXP: i32
const MAX_EXP: i32
See f64::MAX_EXP.
Sourceconst MIN_10_EXP: i32
const MIN_10_EXP: i32
See f64::MIN_10_EXP.
Sourceconst MIN_EXP: i32
const MIN_EXP: i32
See f64::MIN_EXP.
Sourceconst MIN_POSITIVE: Self
const MIN_POSITIVE: Self
See f64::MIN_POSITIVE.
Sourceconst NEG_INFINITY: Self
const NEG_INFINITY: Self
See f64::NEG_INFINITY.
Sourceconst PI: Self
const PI: Self
See f64::consts::PI.
Sourceconst RADIX: u32
const RADIX: u32
See f64::RADIX.
Sourceconst SQRT_2: Self
const SQRT_2: Self
See f64::consts::SQRT_2.
Sourceconst TAU: Self
const TAU: Self
See f64::consts::TAU.
Required Associated Types§
Required Methods§
Sourcefn clamp(self, min: Self, max: Self) -> Self
fn clamp(self, min: Self, max: Self) -> Self
See f64::clamp.
Sourcefn classify(self) -> FpCategory
fn classify(self) -> FpCategory
See f64::classify.
Sourcefn copysign(self, rhs: Self) -> Self
fn copysign(self, rhs: Self) -> Self
See f64::copysign.
Sourcefn from_bits(bits: Self::Bits) -> Self
fn from_bits(bits: Self::Bits) -> Self
See f64::from_bits.
Sourcefn is_finite(self) -> bool
fn is_finite(self) -> bool
See f64::is_finite.
Sourcefn is_infinite(self) -> bool
fn is_infinite(self) -> bool
See f64::is_infinite.
Sourcefn is_nan(self) -> bool
fn is_nan(self) -> bool
See f64::is_nan.
Sourcefn is_normal(self) -> bool
fn is_normal(self) -> bool
See f64::is_normal.
Sourcefn is_sign_negative(self) -> bool
fn is_sign_negative(self) -> bool
Sourcefn is_sign_positive(self) -> bool
fn is_sign_positive(self) -> bool
Sourcefn is_subnormal(self) -> bool
fn is_subnormal(self) -> bool
See f64::is_subnormal.
Sourcefn midpoint(self, rhs: Self) -> Self
fn midpoint(self, rhs: Self) -> Self
See f64::midpoint.
Sourcefn next_down(self) -> Self
fn next_down(self) -> Self
See f64::next_down.
Sourcefn next_up(self) -> Self
fn next_up(self) -> Self
See f64::next_up.
Sourcefn recip(self) -> Self
fn recip(self) -> Self
See f64::recip.
Sourcefn signum(self) -> Self
fn signum(self) -> Self
See f64::signum.
Sourcefn to_bits(self) -> Self::Bits
fn to_bits(self) -> Self::Bits
See f64::to_bits.
Sourcefn to_degrees(self) -> Self
fn to_degrees(self) -> Self
See f64::to_degrees.
Sourcefn to_radians(self) -> Self
fn to_radians(self) -> Self
See f64::to_radians.
Sourcefn total_cmp(&self, rhs: &Self) -> Ordering
fn total_cmp(&self, rhs: &Self) -> Ordering
See f64::total_cmp.
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 FloatingPoint for f16
Available on crate feature f16 only.
impl FloatingPoint for f16
f16 only.const DIGITS: u32 = Self::DIGITS
const E: Self = ::core::f16::consts::E
const EPSILON: Self = Self::EPSILON
const EULER_GAMMA: Self = 0.577215664901532860606512090082402431042159335939923598805767
const FRAC_1_PI: Self = ::core::f16::consts::FRAC_1_PI
const FRAC_1_SQRT_2: Self = ::core::f16::consts::FRAC_1_SQRT_2
const FRAC_2_PI: Self = ::core::f16::consts::FRAC_2_PI
const FRAC_2_SQRT_PI: Self = ::core::f16::consts::FRAC_2_SQRT_PI
const FRAC_PI_2: Self = ::core::f16::consts::FRAC_PI_2
const FRAC_PI_3: Self = ::core::f16::consts::FRAC_PI_3
const FRAC_PI_4: Self = ::core::f16::consts::FRAC_PI_4
const FRAC_PI_6: Self = ::core::f16::consts::FRAC_PI_6
const FRAC_PI_8: Self = ::core::f16::consts::FRAC_PI_8
const GOLDEN_RATIO: Self = 1.618033988749894848204586834365638117720309179805762862135450
const INFINITY: Self = Self::EPSILON
const LN_10: Self = ::core::f16::consts::LN_10
const LN_2: Self = ::core::f16::consts::LN_2
const LOG10_2: Self = ::core::f16::consts::LOG10_2
const LOG10_E: Self = ::core::f16::consts::LOG10_E
const LOG2_10: Self = ::core::f16::consts::LOG2_10
const LOG2_E: Self = ::core::f16::consts::LOG2_E
const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS
const MAX: Self = Self::MAX
const MAX_10_EXP: i32 = Self::MAX_10_EXP
const MAX_EXP: i32 = Self::MAX_EXP
const MIN: Self = Self::MIN
const MIN_10_EXP: i32 = Self::MIN_10_EXP
const MIN_EXP: i32 = Self::MIN_EXP
const MIN_POSITIVE: Self = Self::MIN_POSITIVE
const NAN: Self = Self::NAN
const NEG_INFINITY: Self = Self::NEG_INFINITY
const PI: Self = ::core::f16::consts::PI
const RADIX: u32 = Self::RADIX
const SQRT_2: Self = ::core::f16::consts::SQRT_2
const TAU: Self = ::core::f16::consts::TAU
type Bits = u16
fn abs(self) -> Self
fn clamp(self, min: Self, max: Self) -> Self
fn classify(self) -> FpCategory
fn copysign(self, rhs: Self) -> Self
fn from_bits(bits: Self::Bits) -> Self
fn is_finite(self) -> bool
fn is_infinite(self) -> bool
fn is_nan(self) -> bool
fn is_normal(self) -> bool
fn is_sign_negative(self) -> bool
fn is_sign_positive(self) -> bool
fn is_subnormal(self) -> bool
fn max(self, rhs: Self) -> Self
fn midpoint(self, rhs: Self) -> Self
fn min(self, rhs: Self) -> Self
fn next_down(self) -> Self
fn next_up(self) -> Self
fn recip(self) -> Self
fn signum(self) -> Self
fn to_bits(self) -> Self::Bits
fn to_degrees(self) -> Self
fn to_radians(self) -> Self
fn total_cmp(&self, rhs: &Self) -> Ordering
Source§impl FloatingPoint for f32
impl FloatingPoint for f32
const DIGITS: u32 = Self::DIGITS
const E: Self = ::core::f32::consts::E
const EPSILON: Self = Self::EPSILON
const EULER_GAMMA: Self = 0.577215664901532860606512090082402431042159335939923598805767
const FRAC_1_PI: Self = ::core::f32::consts::FRAC_1_PI
const FRAC_1_SQRT_2: Self = ::core::f32::consts::FRAC_1_SQRT_2
const FRAC_2_PI: Self = ::core::f32::consts::FRAC_2_PI
const FRAC_2_SQRT_PI: Self = ::core::f32::consts::FRAC_2_SQRT_PI
const FRAC_PI_2: Self = ::core::f32::consts::FRAC_PI_2
const FRAC_PI_3: Self = ::core::f32::consts::FRAC_PI_3
const FRAC_PI_4: Self = ::core::f32::consts::FRAC_PI_4
const FRAC_PI_6: Self = ::core::f32::consts::FRAC_PI_6
const FRAC_PI_8: Self = ::core::f32::consts::FRAC_PI_8
const GOLDEN_RATIO: Self = 1.618033988749894848204586834365638117720309179805762862135450
const INFINITY: Self = Self::EPSILON
const LN_10: Self = ::core::f32::consts::LN_10
const LN_2: Self = ::core::f32::consts::LN_2
const LOG10_2: Self = ::core::f32::consts::LOG10_2
const LOG10_E: Self = ::core::f32::consts::LOG10_E
const LOG2_10: Self = ::core::f32::consts::LOG2_10
const LOG2_E: Self = ::core::f32::consts::LOG2_E
const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS
const MAX: Self = Self::MAX
const MAX_10_EXP: i32 = Self::MAX_10_EXP
const MAX_EXP: i32 = Self::MAX_EXP
const MIN: Self = Self::MIN
const MIN_10_EXP: i32 = Self::MIN_10_EXP
const MIN_EXP: i32 = Self::MIN_EXP
const MIN_POSITIVE: Self = Self::MIN_POSITIVE
const NAN: Self = Self::NAN
const NEG_INFINITY: Self = Self::NEG_INFINITY
const PI: Self = ::core::f32::consts::PI
const RADIX: u32 = Self::RADIX
const SQRT_2: Self = ::core::f32::consts::SQRT_2
const TAU: Self = ::core::f32::consts::TAU
type Bits = u32
fn abs(self) -> Self
fn clamp(self, min: Self, max: Self) -> Self
fn classify(self) -> FpCategory
fn copysign(self, rhs: Self) -> Self
fn from_bits(bits: Self::Bits) -> Self
fn is_finite(self) -> bool
fn is_infinite(self) -> bool
fn is_nan(self) -> bool
fn is_normal(self) -> bool
fn is_sign_negative(self) -> bool
fn is_sign_positive(self) -> bool
fn is_subnormal(self) -> bool
fn max(self, rhs: Self) -> Self
fn midpoint(self, rhs: Self) -> Self
fn min(self, rhs: Self) -> Self
fn next_down(self) -> Self
fn next_up(self) -> Self
fn recip(self) -> Self
fn signum(self) -> Self
fn to_bits(self) -> Self::Bits
fn to_degrees(self) -> Self
fn to_radians(self) -> Self
fn total_cmp(&self, rhs: &Self) -> Ordering
Source§impl FloatingPoint for f64
impl FloatingPoint for f64
const DIGITS: u32 = Self::DIGITS
const E: Self = ::core::f64::consts::E
const EPSILON: Self = Self::EPSILON
const EULER_GAMMA: Self = 0.577215664901532860606512090082402431042159335939923598805767
const FRAC_1_PI: Self = ::core::f64::consts::FRAC_1_PI
const FRAC_1_SQRT_2: Self = ::core::f64::consts::FRAC_1_SQRT_2
const FRAC_2_PI: Self = ::core::f64::consts::FRAC_2_PI
const FRAC_2_SQRT_PI: Self = ::core::f64::consts::FRAC_2_SQRT_PI
const FRAC_PI_2: Self = ::core::f64::consts::FRAC_PI_2
const FRAC_PI_3: Self = ::core::f64::consts::FRAC_PI_3
const FRAC_PI_4: Self = ::core::f64::consts::FRAC_PI_4
const FRAC_PI_6: Self = ::core::f64::consts::FRAC_PI_6
const FRAC_PI_8: Self = ::core::f64::consts::FRAC_PI_8
const GOLDEN_RATIO: Self = 1.618033988749894848204586834365638117720309179805762862135450
const INFINITY: Self = Self::EPSILON
const LN_10: Self = ::core::f64::consts::LN_10
const LN_2: Self = ::core::f64::consts::LN_2
const LOG10_2: Self = ::core::f64::consts::LOG10_2
const LOG10_E: Self = ::core::f64::consts::LOG10_E
const LOG2_10: Self = ::core::f64::consts::LOG2_10
const LOG2_E: Self = ::core::f64::consts::LOG2_E
const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS
const MAX: Self = Self::MAX
const MAX_10_EXP: i32 = Self::MAX_10_EXP
const MAX_EXP: i32 = Self::MAX_EXP
const MIN: Self = Self::MIN
const MIN_10_EXP: i32 = Self::MIN_10_EXP
const MIN_EXP: i32 = Self::MIN_EXP
const MIN_POSITIVE: Self = Self::MIN_POSITIVE
const NAN: Self = Self::NAN
const NEG_INFINITY: Self = Self::NEG_INFINITY
const PI: Self = ::core::f64::consts::PI
const RADIX: u32 = Self::RADIX
const SQRT_2: Self = ::core::f64::consts::SQRT_2
const TAU: Self = ::core::f64::consts::TAU
type Bits = u64
fn abs(self) -> Self
fn clamp(self, min: Self, max: Self) -> Self
fn classify(self) -> FpCategory
fn copysign(self, rhs: Self) -> Self
fn from_bits(bits: Self::Bits) -> Self
fn is_finite(self) -> bool
fn is_infinite(self) -> bool
fn is_nan(self) -> bool
fn is_normal(self) -> bool
fn is_sign_negative(self) -> bool
fn is_sign_positive(self) -> bool
fn is_subnormal(self) -> bool
fn max(self, rhs: Self) -> Self
fn midpoint(self, rhs: Self) -> Self
fn min(self, rhs: Self) -> Self
fn next_down(self) -> Self
fn next_up(self) -> Self
fn recip(self) -> Self
fn signum(self) -> Self
fn to_bits(self) -> Self::Bits
fn to_degrees(self) -> Self
fn to_radians(self) -> Self
fn total_cmp(&self, rhs: &Self) -> Ordering
Source§impl FloatingPoint for f128
Available on crate feature f128 only.
impl FloatingPoint for f128
f128 only.