pub struct FloatProperties { /* private fields */ }
Expand description
properties of a particular floating-point format
Implementations§
Source§impl FloatProperties
impl FloatProperties
Sourcepub const STANDARD_16: Self
pub const STANDARD_16: Self
FloatProperties
for standard binary16 format
Sourcepub const STANDARD_32: Self
pub const STANDARD_32: Self
FloatProperties
for standard binary32 format
Sourcepub const STANDARD_64: Self
pub const STANDARD_64: Self
FloatProperties
for standard binary64 format
Sourcepub const STANDARD_128: Self
pub const STANDARD_128: Self
FloatProperties
for standard binary128 format
Sourcepub fn check_compatibility(
self,
other: Self,
) -> Result<(), FloatPropertiesIncompatible>
pub fn check_compatibility( self, other: Self, ) -> Result<(), FloatPropertiesIncompatible>
check for compatibility between two FloatProperties
values
Sourcepub 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
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
Sourcepub const fn new(exponent_width: usize, mantissa_width: usize) -> Self
pub const fn new(exponent_width: usize, mantissa_width: usize) -> Self
create a new FloatProperties
value
Sourcepub const fn new_with_platform_properties(
exponent_width: usize,
mantissa_width: usize,
platform_properties: PlatformProperties,
) -> Self
pub const fn new_with_platform_properties( exponent_width: usize, mantissa_width: usize, platform_properties: PlatformProperties, ) -> Self
create a new FloatProperties
value
Sourcepub const fn standard_16_with_platform_properties(
platform_properties: PlatformProperties,
) -> Self
pub const fn standard_16_with_platform_properties( platform_properties: PlatformProperties, ) -> Self
FloatProperties
for standard binary16 format
Sourcepub const fn standard_32_with_platform_properties(
platform_properties: PlatformProperties,
) -> Self
pub const fn standard_32_with_platform_properties( platform_properties: PlatformProperties, ) -> Self
FloatProperties
for standard binary32 format
Sourcepub const fn standard_64_with_platform_properties(
platform_properties: PlatformProperties,
) -> Self
pub const fn standard_64_with_platform_properties( platform_properties: PlatformProperties, ) -> Self
FloatProperties
for standard binary64 format
Sourcepub const fn standard_128_with_platform_properties(
platform_properties: PlatformProperties,
) -> Self
pub const fn standard_128_with_platform_properties( platform_properties: PlatformProperties, ) -> Self
FloatProperties
for standard binary128 format
Sourcepub fn standard_with_platform_properties(
width: usize,
platform_properties: PlatformProperties,
) -> Option<Self>
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
Sourcepub fn standard(width: usize) -> Option<Self>
pub fn standard(width: usize) -> Option<Self>
construct FloatProperties
for standard width
-bit binary interchange format, if it exists
Sourcepub fn is_standard(self) -> bool
pub fn is_standard(self) -> bool
check if self
is a standard binary interchange format.
Sourcepub const fn exponent_width(self) -> usize
pub const fn exponent_width(self) -> usize
the number of bits in the exponent field
Sourcepub const fn mantissa_width(self) -> usize
pub const fn mantissa_width(self) -> usize
the number of bits in the mantissa field (excludes any implicit leading bit)
Sourcepub const fn has_implicit_leading_bit(self) -> bool
pub const fn has_implicit_leading_bit(self) -> bool
if the floating-point format uses an implicit leading bit
Sourcepub const fn has_sign_bit(self) -> bool
pub const fn has_sign_bit(self) -> bool
if the floating-point format has a sign bit
Sourcepub const fn platform_properties(self) -> PlatformProperties
pub const fn platform_properties(self) -> PlatformProperties
get the PlatformProperties
Sourcepub fn quiet_nan_format(self) -> QuietNaNFormat
pub fn quiet_nan_format(self) -> QuietNaNFormat
get the QuietNaNFormat
Sourcepub const fn fraction_width(self) -> usize
pub const fn fraction_width(self) -> usize
get the number of bits after the radix point in the representation of normal floating-point values
Sourcepub const fn sign_field_shift(self) -> usize
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
Sourcepub fn sign_field_mask<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub const fn exponent_field_shift(self) -> usize
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
Sourcepub fn exponent_field_mask<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub const fn mantissa_field_shift(self) -> usize
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
Sourcepub fn mantissa_field_mask<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub fn mantissa_field_max<Bits: FloatBitsType>(self) -> Bits
pub fn mantissa_field_max<Bits: FloatBitsType>(self) -> Bits
get the maximum value of the mantissa field
Sourcepub fn mantissa_field_normal_min<Bits: FloatBitsType>(self) -> Bits
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.
Sourcepub const fn mantissa_field_msb_shift(self) -> usize
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
Sourcepub fn mantissa_field_msb_mask<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub fn exponent_bias<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub fn exponent_inf_nan<Bits: FloatBitsType>(self) -> Bits
pub fn exponent_inf_nan<Bits: FloatBitsType>(self) -> Bits
get the value used in the exponent field for infinities and NaNs
Sourcepub fn exponent_zero_subnormal<Bits: FloatBitsType>(self) -> Bits
pub fn exponent_zero_subnormal<Bits: FloatBitsType>(self) -> Bits
get the value used in the exponent field for zeros and subnormals
Sourcepub fn exponent_min_normal<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub fn exponent_max_normal<Bits: FloatBitsType>(self) -> Bits
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
Sourcepub fn overall_mask<Bits: FloatBitsType>(self) -> Bits
pub fn overall_mask<Bits: FloatBitsType>(self) -> Bits
get the mask for the whole floating-point format
Trait Implementations§
Source§impl Clone for FloatProperties
impl Clone for FloatProperties
Source§fn clone(&self) -> FloatProperties
fn clone(&self) -> FloatProperties
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FloatProperties
impl Debug for FloatProperties
Source§impl FloatTraits for FloatProperties
impl FloatTraits for FloatProperties
Source§fn properties(&self) -> FloatProperties
fn properties(&self) -> FloatProperties
FloatProperties
value