#[repr(C)]
pub struct Ieee64(_);
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§

source§

impl Ieee64

source

pub fn with_bits(x: u64) -> Self

Create a new Ieee64 containing the bits of x.

source

pub fn pow2<I: Into<i64>>(n: I) -> Self

Create an Ieee64 number representing 2.0^n.

source

pub fn fcvt_to_sint_negative_overflow<I: Into<i64>>(n: I) -> Self

Create an Ieee64 number representing the greatest negative value not convertable from f64 to a signed integer with width n.

source

pub fn neg(self) -> Self

Return self negated.

source

pub fn with_float(x: f64) -> Self

Create a new Ieee64 representing the number x.

source

pub fn bits(self) -> u64

Get the bitwise representation.

source

pub fn is_nan(&self) -> bool

Check if the value is a NaN. For Ieee64, this means checking that the 11 exponent bits are all set.

source

pub fn as_f64(self) -> f64

Converts Self to a rust f64

source

pub fn sqrt(self) -> Self

Returns the square root of self.

source

pub fn abs(self) -> Self

Computes the absolute value of self.

source

pub fn copysign(self, sign: Self) -> Self

Returns a number composed of the magnitude of self and the sign of sign.

source

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.

source

pub fn is_zero(&self) -> bool

Returns true if self is positive or negative zero

source

pub fn ceil(self) -> Self

Returns the smallest integer greater than or equal to self.

source

pub fn floor(self) -> Self

Returns the largest integer less than or equal to self.

source

pub fn trunc(self) -> Self

Returns the integer part of self. This means that non-integer numbers are always truncated towards zero.

source

pub fn round_ties_even(self) -> Self

Returns the nearest integer to self. Rounds half-way cases to the number with an even least significant digit.

Trait Implementations§

source§

impl Add<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl BitAnd<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl BitOr<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl BitXor<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl Clone for Ieee64

source§

fn clone(&self) -> Ieee64

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Ieee64

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Ieee64

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl From<Ieee64> for DataValue

source§

fn from(data: Ieee64) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Ieee64

source§

fn from(x: f64) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Ieee64

source§

fn from(x: u64) -> Self

Converts to this type from the input type.
source§

impl FromStr for Ieee64

§

type Err = &'static str

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, &'static str>

Parses a string s to return a value of this type. Read more
source§

impl Hash for Ieee64

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl IntoBytes for Ieee64

source§

fn into_bytes(self) -> Vec<u8>

Return the little-endian byte representation of the implementing type.
source§

impl Mul<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl Neg for Ieee64

§

type Output = Ieee64

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl Not for Ieee64

§

type Output = Ieee64

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl PartialEq<Ieee64> for Ieee64

source§

fn eq(&self, other: &Ieee64) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Ieee64> for Ieee64

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Sub<Ieee64> for Ieee64

§

type Output = Ieee64

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl TryInto<Ieee64> for DataValue

§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Ieee64, Self::Error>

Performs the conversion.
source§

impl Copy for Ieee64

source§

impl Eq for Ieee64

source§

impl StructuralEq for Ieee64

source§

impl StructuralPartialEq for Ieee64

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.