pub struct F32(pub f32);Expand description
32-bit floating point wrapper which implements fast approximation-based operations.
Tuple Fields§
§0: f32Implementations§
source§impl F32
impl F32
sourcepub fn div_euclid(self, rhs: Self) -> Self
pub fn div_euclid(self, rhs: Self) -> Self
Calculates Euclidean division, the matching method for rem_euclid.
source§impl F32
impl F32
sourcepub fn rem_euclid(self, rhs: Self) -> Self
pub fn rem_euclid(self, rhs: Self) -> Self
Calculates the least non-negative remainder of self (mod rhs).
source§impl F32
impl F32
sourcepub fn sin_cos(self) -> (Self, Self)
pub fn sin_cos(self) -> (Self, Self)
Simultaneously computes the sine and cosine of the number, x.
Returns (sin(x), cos(x)).
source§impl F32
impl F32
sourcepub const MANTISSA_DIGITS: u32 = 24u32
pub const MANTISSA_DIGITS: u32 = 24u32
Number of significant digits in base 2.
sourcepub const EPSILON: Self = _
pub const EPSILON: Self = _
Machine epsilon value for f32.
This is the difference between 1.0 and the next larger representable number.
sourcepub const MIN_POSITIVE: Self = _
pub const MIN_POSITIVE: Self = _
Smallest positive normal f32 value.
sourcepub const MIN_EXP: i32 = -125i32
pub const MIN_EXP: i32 = -125i32
One greater than the minimum possible normal power of 2 exponent.
sourcepub const MIN_10_EXP: i32 = -37i32
pub const MIN_10_EXP: i32 = -37i32
Minimum possible normal power of 10 exponent.
sourcepub const MAX_10_EXP: i32 = 38i32
pub const MAX_10_EXP: i32 = 38i32
Maximum possible power of 10 exponent.
sourcepub const NEG_INFINITY: Self = _
pub const NEG_INFINITY: Self = _
Negative infinity (−∞).
sourcepub fn is_infinite(self) -> bool
pub fn is_infinite(self) -> bool
Returns true if this value is positive infinity or negative infinity, and
false otherwise.
sourcepub fn is_sign_positive(self) -> bool
pub fn is_sign_positive(self) -> bool
Returns true if self has a positive sign, including +0.0, NaNs with
positive sign bit and positive infinity.
sourcepub fn is_sign_negative(self) -> bool
pub fn is_sign_negative(self) -> bool
Returns true if self has a negative sign, including -0.0, NaNs with
negative sign bit and negative infinity.
sourcepub fn to_bits(self) -> u32
pub fn to_bits(self) -> u32
Raw transmutation to u32.
This is currently identical to transmute::<f32, u32>(self) on all platforms.
See F32::from_bits for some discussion of the portability of this operation
(there are almost no issues).
sourcepub fn from_bits(v: u32) -> Self
pub fn from_bits(v: u32) -> Self
Raw transmutation from u32.
This is currently identical to transmute::<u32, f32>(v) on all platforms.
It turns out this is incredibly portable, for two reasons:
- Floats and Ints have the same endianness on all supported platforms.
- IEEE-754 very precisely specifies the bit layout of floats.
See f32::from_bits for more information.
Trait Implementations§
source§impl AddAssign<F32> for f32
impl AddAssign<F32> for f32
source§fn add_assign(&mut self, rhs: F32)
fn add_assign(&mut self, rhs: F32)
+= operation. Read moresource§impl AddAssign<f32> for F32
impl AddAssign<f32> for F32
source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
+= operation. Read moresource§impl AddAssign for F32
impl AddAssign for F32
source§fn add_assign(&mut self, rhs: F32)
fn add_assign(&mut self, rhs: F32)
+= operation. Read moresource§impl DivAssign<F32> for f32
impl DivAssign<F32> for f32
source§fn div_assign(&mut self, rhs: F32)
fn div_assign(&mut self, rhs: F32)
/= operation. Read moresource§impl DivAssign<f32> for F32
impl DivAssign<f32> for F32
source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moresource§impl DivAssign for F32
impl DivAssign for F32
source§fn div_assign(&mut self, rhs: F32)
fn div_assign(&mut self, rhs: F32)
/= operation. Read moresource§impl MulAssign<F32> for f32
impl MulAssign<F32> for f32
source§fn mul_assign(&mut self, rhs: F32)
fn mul_assign(&mut self, rhs: F32)
*= operation. Read moresource§impl MulAssign<f32> for F32
impl MulAssign<f32> for F32
source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read moresource§impl MulAssign for F32
impl MulAssign for F32
source§fn mul_assign(&mut self, rhs: F32)
fn mul_assign(&mut self, rhs: F32)
*= operation. Read moresource§impl PartialOrd<F32> for f32
impl PartialOrd<F32> for f32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl PartialOrd<f32> for F32
impl PartialOrd<f32> for F32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl PartialOrd for F32
impl PartialOrd for F32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl RemAssign<f32> for F32
impl RemAssign<f32> for F32
source§fn rem_assign(&mut self, rhs: f32)
fn rem_assign(&mut self, rhs: f32)
%= operation. Read moresource§impl RemAssign for F32
impl RemAssign for F32
source§fn rem_assign(&mut self, rhs: F32)
fn rem_assign(&mut self, rhs: F32)
%= operation. Read moresource§impl SubAssign<F32> for f32
impl SubAssign<F32> for f32
source§fn sub_assign(&mut self, rhs: F32)
fn sub_assign(&mut self, rhs: F32)
-= operation. Read moresource§impl SubAssign<f32> for F32
impl SubAssign<f32> for F32
source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
-= operation. Read moresource§impl SubAssign for F32
impl SubAssign for F32
source§fn sub_assign(&mut self, rhs: F32)
fn sub_assign(&mut self, rhs: F32)
-= operation. Read more