Struct Ieee64
#[repr(C)]pub struct Ieee64 { /* private fields */ }
Expand description
An IEEE binary64 immediate floating point value, represented as a u64 containing the bit pattern.
We specifically avoid using a f64 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§
§impl Ieee64
impl Ieee64
pub fn with_float(x: f64) -> Ieee64
pub fn with_float(x: f64) -> Ieee64
Create a new
Ieee64
representing the number x
.
pub fn copysign(self, sign: Ieee64) -> Ieee64
pub fn copysign(self, sign: Ieee64) -> Ieee64
Returns a number composed of the magnitude of self
and the sign of sign
.
pub fn minimum(self, other: Ieee64) -> Ieee64
pub fn minimum(self, other: Ieee64) -> Ieee64
Returns the minimum of self
and other
, following the WebAssembly/IEEE 754-2019 definition.
pub fn maximum(self, other: Ieee64) -> Ieee64
pub fn maximum(self, other: Ieee64) -> Ieee64
Returns the maximum of self
and other
, following the WebAssembly/IEEE 754-2019 definition.
pub fn fcvt_to_sint_negative_overflow<I>(n: I) -> Ieee64
pub fn fcvt_to_sint_negative_overflow<I>(n: I) -> Ieee64
Create an
Ieee64
number representing the greatest negative value not convertible from
f64
to a signed integer with width n.
pub fn is_nan(self) -> bool
pub fn is_nan(self) -> bool
Check if the value is a NaN. For
Ieee64
,
this means checking that all the exponent bits are set and the significand is non-zero.
pub 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.
pub 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.
pub fn trunc(self) -> Ieee64
pub fn trunc(self) -> Ieee64
Returns the integer part of self
. This means that non-integer numbers are always truncated towards zero.
pub fn round_ties_even(self) -> Ieee64
pub fn round_ties_even(self) -> Ieee64
Returns the nearest integer to self
. Rounds half-way cases to the number
with an even least significant digit.
Trait Implementations§
§impl<'de> Deserialize<'de> for Ieee64
impl<'de> Deserialize<'de> for Ieee64
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Ieee64, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Ieee64, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl IntoBytes for Ieee64
impl IntoBytes for Ieee64
§fn into_bytes(self) -> Vec<u8>
fn into_bytes(self) -> Vec<u8>
§impl PartialOrd for Ieee64
impl PartialOrd for Ieee64
§impl Serialize for Ieee64
impl Serialize for Ieee64
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for Ieee64
impl Eq for Ieee64
impl StructuralPartialEq for Ieee64
Auto Trait Implementations§
impl Freeze for Ieee64
impl RefUnwindSafe for Ieee64
impl Send for Ieee64
impl Sync for Ieee64
impl Unpin for Ieee64
impl UnwindSafe for Ieee64
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.