#[repr(C)]pub struct Ieee32 { /* private fields */ }
Expand description
An IEEE binary32 immediate floating point value, represented as a u32 containing the bit pattern.
We specifically avoid using a f32 here since some architectures may silently alter floats. See: https://github.com/bytecodealliance/wasmtime/pull/2251#discussion_r498508646
The PartialEq and Hash implementations are over the underlying bit pattern, but PartialOrd respects IEEE754 semantics.
All bit patterns are allowed.
Implementations§
source§impl Ieee32
impl Ieee32
sourcepub fn with_float(x: f32) -> Ieee32
pub fn with_float(x: f32) -> Ieee32
Create a new
Ieee32
representing the number x
.
sourcepub fn copysign(self, sign: Ieee32) -> Ieee32
pub fn copysign(self, sign: Ieee32) -> Ieee32
Returns a number composed of the magnitude of self
and the sign of sign
.
sourcepub fn minimum(self, other: Ieee32) -> Ieee32
pub fn minimum(self, other: Ieee32) -> Ieee32
Returns the minimum of self
and other
, following the WebAssembly/IEEE 754-2019 definition.
sourcepub fn maximum(self, other: Ieee32) -> Ieee32
pub fn maximum(self, other: Ieee32) -> Ieee32
Returns the maximum of self
and other
, following the WebAssembly/IEEE 754-2019 definition.
sourcepub fn fcvt_to_sint_negative_overflow<I>(n: I) -> Ieee32
pub fn fcvt_to_sint_negative_overflow<I>(n: I) -> Ieee32
Create an
Ieee32
number representing the greatest negative value not convertible from
f32
to a signed integer with width n.
sourcepub fn is_nan(self) -> bool
pub fn is_nan(self) -> bool
Check if the value is a NaN. For
Ieee32
,
this means checking that all the exponent bits are set and the significand is non-zero.
sourcepub fn is_positive(self) -> bool
pub fn is_positive(self) -> bool
Returns true if self
has a negative sign, including 0.0, NaNs with positive sign bit and positive infinity.
sourcepub fn is_negative(self) -> bool
pub fn is_negative(self) -> bool
Returns true if self
has a negative sign, including -0.0, NaNs with negative sign bit and negative infinity.
sourcepub fn trunc(self) -> Ieee32
pub fn trunc(self) -> Ieee32
Returns the integer part of self
. This means that non-integer numbers are always truncated towards zero.
sourcepub fn round_ties_even(self) -> Ieee32
pub fn round_ties_even(self) -> Ieee32
Returns the nearest integer to self
. Rounds half-way cases to the number
with an even least significant digit.
Trait Implementations§
source§impl IntoBytes for Ieee32
impl IntoBytes for Ieee32
source§fn into_bytes(self) -> Vec<u8>
fn into_bytes(self) -> Vec<u8>
source§impl PartialOrd for Ieee32
impl PartialOrd for Ieee32
impl Copy for Ieee32
impl Eq for Ieee32
impl StructuralPartialEq for Ieee32
Auto Trait Implementations§
impl Freeze for Ieee32
impl RefUnwindSafe for Ieee32
impl Send for Ieee32
impl Sync for Ieee32
impl Unpin for Ieee32
impl UnwindSafe for Ieee32
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.