rok::core::num::floats
rok::core::num::floats - f32 / f64 inherent methods and constants
(stdlib spec 2.1.4). The math functions are libm's (floor, sin,
pow, ..) behind the runtime's rok_f64_* / rok_f32_* symbols
(runtime/rokr/src/math.rs); to_bits / from_bits reinterpret
through a union. sqrt is the Sqrt trait's (num.rok).
Implementations
impl f64
pub const EPSILON: f64 = 2.2204460492503131e-16pub const MAX: f64 = 1.7976931348623157e308pub const MIN: f64 = -1.7976931348623157e308pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308pub const NAN: f64 = 0.0 / 0.0pub const INFINITY: f64 = 1.0 / 0.0pub const NEG_INFINITY: f64 = -1.0 / 0.0pub const PI: f64 = 3.14159265358979323846264338327950288pub const TAU: f64 = 6.28318530717958647692528676655900577pub const E: f64 = 2.71828182845904523536028747135266250pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144pub const FRAC_PI_4: f64 = 0.785398163397448309615660845819875721pub const FRAC_1_PI: f64 = 0.318309886183790671537767526745028724pub const SQRT_2: f64 = 1.41421356237309504880168872420969808pub const FRAC_1_SQRT_2: f64 = 0.707106781186547524400844362104849039pub const LN_2: f64 = 0.693147180559945309417232121458176568pub const LN_10: f64 = 2.30258509299404568401799145468436421pub const LOG2_E: f64 = 1.44269504088896340735992468100189214pub const LOG10_E: f64 = 0.434294481903251827651128918916605082pub const fn nan() -> f64pub const fn infinity() -> f64pub const fn neg_infinity() -> f64pub const fn epsilon() -> f64The gap between
1.0and the next f64 (EPSILON).pub const fn to_bits(self) -> u64The IEEE 754 bit pattern.
pub const fn from_bits(bits: u64) -> f64pub const fn is_nan(self) -> boolpub const fn is_infinite(self) -> boolpub const fn is_finite(self) -> boolpub const fn is_normal(self) -> boolNeither zero, subnormal, infinite nor NaN.
pub const fn is_sign_positive(self) -> boolpub const fn is_sign_negative(self) -> boolpub const fn floor(self) -> f64Largest integer
<= self.pub const fn ceil(self) -> f64Smallest integer
>= self.pub const fn round(self) -> f64Nearest integer, halves away from zero.
pub const fn trunc(self) -> f64Integer part (toward zero).
pub const fn abs(self) -> f64pub fn cbrt(self) -> f64pub fn exp(self) -> f64e^self.pub fn exp2(self) -> f642^self.pub fn exp_m1(self) -> f64e^self - 1, exact near zero.pub fn ln(self) -> f64Natural logarithm.
pub fn ln_1p(self) -> f64ln(1 + self), exact near zero.pub fn log2(self) -> f64pub fn log10(self) -> f64pub fn sin(self) -> f64pub fn cos(self) -> f64pub fn tan(self) -> f64pub fn asin(self) -> f64pub fn acos(self) -> f64pub fn atan(self) -> f64pub fn sinh(self) -> f64pub fn cosh(self) -> f64pub fn tanh(self) -> f64pub fn asinh(self) -> f64pub fn acosh(self) -> f64pub fn atanh(self) -> f64pub const fn fract(self) -> f64self - self.trunc().pub const fn signum(self) -> f64-1.0/1.0by sign; zeros and NaN are returned as they are (spec 2.1.4:-1.0, 0.0, or 1.0).pub const fn recip(self) -> f64pub const fn to_degrees(self) -> f64pub const fn to_radians(self) -> f64pub fn log(self, base: f64) -> f64ln(self) / ln(base).pub fn pow(self, exp: f64) -> f64self^exp(spec 2.1.4;powfin Rust).pub fn atan2(self, other: f64) -> f64Angle of the point
(other, self).pub fn hypot(self, other: f64) -> f64sqrt(self² + other²)without overflow.pub const fn copysign(self, sign: f64) -> f64self's magnitude withsign's sign.pub const fn min(self, other: f64) -> f64The smaller; a NaN operand loses to a number.
pub const fn max(self, other: f64) -> f64The larger; a NaN operand loses to a number.
pub fn powf(self, exp: f64) -> f64pub fn powi(self, n: i32) -> f64pub const fn mul_add(self, a: f64, b: f64) -> f64self * a + bwith one rounding.pub const fn clamp(self, lo: f64, hi: f64) -> f64selflimited tolo..=hi; NaN stays NaN.pub const fn div_euclid(self, rhs: f64) -> f64pub const fn rem_euclid(self, rhs: f64) -> f64
impl f32
pub const EPSILON: f32 = 1.1920929e-7pub const MAX: f32 = 3.40282347e38pub const MIN: f32 = -3.40282347e38pub const MIN_POSITIVE: f32 = 1.17549435e-38pub const NAN: f32 = 0.0 / 0.0pub const INFINITY: f32 = 1.0 / 0.0pub const NEG_INFINITY: f32 = -1.0 / 0.0pub const PI: f32 = 3.14159265358979323846264338327950288pub const TAU: f32 = 6.28318530717958647692528676655900577pub const E: f32 = 2.71828182845904523536028747135266250pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144pub const FRAC_PI_4: f32 = 0.785398163397448309615660845819875721pub const FRAC_1_PI: f32 = 0.318309886183790671537767526745028724pub const SQRT_2: f32 = 1.41421356237309504880168872420969808pub const FRAC_1_SQRT_2: f32 = 0.707106781186547524400844362104849039pub const LN_2: f32 = 0.693147180559945309417232121458176568pub const LN_10: f32 = 2.30258509299404568401799145468436421pub const LOG2_E: f32 = 1.44269504088896340735992468100189214pub const LOG10_E: f32 = 0.434294481903251827651128918916605082pub const fn nan() -> f32pub const fn infinity() -> f32pub const fn neg_infinity() -> f32pub const fn epsilon() -> f32The gap between
1.0and the next f32 (EPSILON).pub const fn to_bits(self) -> u32The IEEE 754 bit pattern.
pub const fn from_bits(bits: u32) -> f32pub const fn is_nan(self) -> boolpub const fn is_infinite(self) -> boolpub const fn is_finite(self) -> boolpub const fn is_normal(self) -> boolNeither zero, subnormal, infinite nor NaN.
pub const fn is_sign_positive(self) -> boolpub const fn is_sign_negative(self) -> boolpub const fn floor(self) -> f32Largest integer
<= self.pub const fn ceil(self) -> f32Smallest integer
>= self.pub const fn round(self) -> f32Nearest integer, halves away from zero.
pub const fn trunc(self) -> f32Integer part (toward zero).
pub const fn abs(self) -> f32pub fn cbrt(self) -> f32pub fn exp(self) -> f32e^self.pub fn exp2(self) -> f322^self.pub fn exp_m1(self) -> f32e^self - 1, exact near zero.pub fn ln(self) -> f32Natural logarithm.
pub fn ln_1p(self) -> f32ln(1 + self), exact near zero.pub fn log2(self) -> f32pub fn log10(self) -> f32pub fn sin(self) -> f32pub fn cos(self) -> f32pub fn tan(self) -> f32pub fn asin(self) -> f32pub fn acos(self) -> f32pub fn atan(self) -> f32pub fn sinh(self) -> f32pub fn cosh(self) -> f32pub fn tanh(self) -> f32pub fn asinh(self) -> f32pub fn acosh(self) -> f32pub fn atanh(self) -> f32pub const fn fract(self) -> f32self - self.trunc().pub const fn signum(self) -> f32-1.0/1.0by sign; zeros and NaN are returned as they are (spec 2.1.4:-1.0, 0.0, or 1.0).pub const fn recip(self) -> f32pub const fn to_degrees(self) -> f32pub const fn to_radians(self) -> f32pub fn log(self, base: f32) -> f32ln(self) / ln(base).pub fn pow(self, exp: f32) -> f32self^exp(spec 2.1.4;powfin Rust).pub fn atan2(self, other: f32) -> f32Angle of the point
(other, self).pub fn hypot(self, other: f32) -> f32sqrt(self² + other²)without overflow.pub const fn copysign(self, sign: f32) -> f32self's magnitude withsign's sign.pub const fn min(self, other: f32) -> f32The smaller; a NaN operand loses to a number.
pub const fn max(self, other: f32) -> f32The larger; a NaN operand loses to a number.
pub fn powf(self, exp: f32) -> f32pub fn powi(self, n: i32) -> f32pub const fn mul_add(self, a: f32, b: f32) -> f32self * a + bwith one rounding.pub const fn clamp(self, lo: f32, hi: f32) -> f32selflimited tolo..=hi; NaN stays NaN.pub const fn div_euclid(self, rhs: f32) -> f32pub const fn rem_euclid(self, rhs: f32) -> f32