pub struct Float(/* private fields */);Implementations§
Source§impl Float
impl Float
pub const NEG_INFINITY: Self
pub const INFINITY: Self
pub const MIN: Self
pub const MAX: Self
pub const NAN: Self
pub fn new(f: f32) -> Self
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_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Returns true if self has a positive sign, including +0.0, NaNs with
positive sign bit and positive infinity.
Note that IEEE 754 doesn’t assign any meaning to the sign bit in case
of a NaN, and as Rust doesn’t guarantee that the bit pattern of NaNs
are conserved over arithmetic operations, the result of
is_positive on a NaN might produce an unexpected result in some
cases.
See explanation of NaN as a special value
for more info.
Sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Returns false if self has a negative sign, including -0.0, NaNs with
negative sign bit and negative infinity.
Note that IEEE 754 doesn’t assign any meaning to the sign bit in case
of a NaN, and as Rust doesn’t guarantee that the bit pattern of NaNs
are conserved over arithmetic operations, the result of
is_negative on a NaN might produce an unexpected result in some
cases.
See explanation of NaN as a special value
for more info.