Skip to main content

FloatProperties

Struct FloatProperties 

Source
pub struct FloatProperties { /* private fields */ }
Expand description

properties of a particular floating-point format

Implementations§

Source§

impl FloatProperties

Source

pub const STANDARD_16: Self

FloatProperties for standard binary16 format

Source

pub const STANDARD_32: Self

FloatProperties for standard binary32 format

Source

pub const STANDARD_64: Self

FloatProperties for standard binary64 format

Source

pub const STANDARD_128: Self

FloatProperties for standard binary128 format

Source

pub fn check_compatibility( self, other: Self, ) -> Result<(), FloatPropertiesIncompatible>

check for compatibility between two FloatProperties values

Source

pub const fn new_with_extended_flags( exponent_width: usize, mantissa_width: usize, has_implicit_leading_bit: bool, has_sign_bit: bool, platform_properties: PlatformProperties, ) -> Self

create a new FloatProperties value

Source

pub const fn new(exponent_width: usize, mantissa_width: usize) -> Self

create a new FloatProperties value

Source

pub const fn new_with_platform_properties( exponent_width: usize, mantissa_width: usize, platform_properties: PlatformProperties, ) -> Self

create a new FloatProperties value

Source

pub const fn standard_16_with_platform_properties( platform_properties: PlatformProperties, ) -> Self

FloatProperties for standard binary16 format

Source

pub const fn standard_32_with_platform_properties( platform_properties: PlatformProperties, ) -> Self

FloatProperties for standard binary32 format

Source

pub const fn standard_64_with_platform_properties( platform_properties: PlatformProperties, ) -> Self

FloatProperties for standard binary64 format

Source

pub const fn standard_128_with_platform_properties( platform_properties: PlatformProperties, ) -> Self

FloatProperties for standard binary128 format

Source

pub fn standard_with_platform_properties( width: usize, platform_properties: PlatformProperties, ) -> Option<Self>

construct FloatProperties for standard width-bit binary interchange format, if it exists

Source

pub fn standard(width: usize) -> Option<Self>

construct FloatProperties for standard width-bit binary interchange format, if it exists

Source

pub fn is_standard(self) -> bool

check if self is a standard binary interchange format.

Source

pub const fn exponent_width(self) -> usize

the number of bits in the exponent field

Source

pub const fn mantissa_width(self) -> usize

the number of bits in the mantissa field (excludes any implicit leading bit)

Source

pub const fn has_implicit_leading_bit(self) -> bool

if the floating-point format uses an implicit leading bit

Source

pub const fn has_sign_bit(self) -> bool

if the floating-point format has a sign bit

Source

pub const fn platform_properties(self) -> PlatformProperties

get the PlatformProperties

Source

pub fn quiet_nan_format(self) -> QuietNaNFormat

get the QuietNaNFormat

Source

pub const fn width(self) -> usize

get the floating-point format’s width in bits

Source

pub const fn fraction_width(self) -> usize

get the number of bits after the radix point in the representation of normal floating-point values

Source

pub const fn sign_field_shift(self) -> usize

get the amount by which the floating-point bits should be shifted right in order to extract the sign field.

the sign field can be extracted using (bits & sign_field_mask) >> sign_field_shift

Source

pub fn sign_field_mask<Bits: FloatBitsType>(self) -> Bits

get the bitwise mask for the sign field (before shifting to extract).

the sign field can be extracted using (bits & sign_field_mask) >> sign_field_shift

Source

pub const fn exponent_field_shift(self) -> usize

get the amount by which the floating-point bits should be shifted right in order to extract the exponent field.

the exponent field can be extracted using (bits & exponent_field_mask) >> exponent_field_shift

Source

pub fn exponent_field_mask<Bits: FloatBitsType>(self) -> Bits

get the bitwise mask for the exponent field (before shifting to extract).

the exponent field can be extracted using (bits & exponent_field_mask) >> exponent_field_shift

Source

pub const fn mantissa_field_shift(self) -> usize

get the amount by which the floating-point bits should be shifted right in order to extract the mantissa field.

the mantissa field can be extracted using (bits & mantissa_field_mask) >> mantissa_field_shift

Source

pub fn mantissa_field_mask<Bits: FloatBitsType>(self) -> Bits

get the bitwise mask for the mantissa field (before shifting to extract).

the mantissa field can be extracted using (bits & mantissa_field_mask) >> mantissa_field_shift

Source

pub fn mantissa_field_max<Bits: FloatBitsType>(self) -> Bits

get the maximum value of the mantissa field

Source

pub fn mantissa_field_normal_min<Bits: FloatBitsType>(self) -> Bits

get the minimum value the mantissa field can take on for normal floating-point numbers.

Source

pub const fn mantissa_field_msb_shift(self) -> usize

get the amount by which the floating-point bits should be shifted right in order to extract the mantissa field’s MSB.

the mantissa field’s MSB can be extracted using (bits & mantissa_field_msb_mask) >> mantissa_field_msb_shift

Source

pub fn mantissa_field_msb_mask<Bits: FloatBitsType>(self) -> Bits

get the bitwise mask for the mantissa field’s MSB (before shifting to extract).

the mantissa field’s MSB can be extracted using (bits & mantissa_field_msb_mask) >> mantissa_field_msb_shift

Source

pub fn exponent_bias<Bits: FloatBitsType>(self) -> Bits

get the amount by which the exponent field is offset from the mathematical exponent for normal floating-point numbers.

the mathematical exponent and the exponent field’s values for normal floating-point numbers are related by the following equation: mathematical_exponent + exponent_bias == exponent_field

Source

pub fn exponent_inf_nan<Bits: FloatBitsType>(self) -> Bits

get the value used in the exponent field for infinities and NaNs

Source

pub fn exponent_zero_subnormal<Bits: FloatBitsType>(self) -> Bits

get the value used in the exponent field for zeros and subnormals

Source

pub fn exponent_min_normal<Bits: FloatBitsType>(self) -> Bits

get the minimum value of the exponent field for normal floating-point numbers.

the mathematical exponent and the exponent field’s values for normal floating-point numbers are related by the following equation: mathematical_exponent + exponent_bias == exponent_field

Source

pub fn exponent_max_normal<Bits: FloatBitsType>(self) -> Bits

get the maximum value of the exponent field for normal floating-point numbers.

the mathematical exponent and the exponent field’s values for normal floating-point numbers are related by the following equation: mathematical_exponent + exponent_bias == exponent_field

Source

pub fn overall_mask<Bits: FloatBitsType>(self) -> Bits

get the mask for the whole floating-point format

Trait Implementations§

Source§

impl Clone for FloatProperties

Source§

fn clone(&self) -> FloatProperties

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for FloatProperties

Source§

impl Debug for FloatProperties

Source§

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

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

impl Eq for FloatProperties

Source§

impl FloatTraits for FloatProperties

Source§

type Bits = BigUint

the type used to represent bits for a floating-point format
Source§

fn properties(&self) -> FloatProperties

get the FloatProperties value
Source§

impl Hash for FloatProperties

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 PartialEq for FloatProperties

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FloatProperties

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.