Semantics

Trait Semantics 

Source
pub trait Semantics: Sized {
    const BITS: usize;
    const EXP_BITS: usize;
    const PRECISION: usize = _;
    const NONFINITE_BEHAVIOR: NonfiniteBehavior = NonfiniteBehavior::IEEE754;
    const MAX_EXP: ExpInt = _;
    const IEEE_MAX_EXP: ExpInt = _;
    const MIN_EXP: ExpInt = Self::IEEE_MIN_EXP;
    const IEEE_MIN_EXP: ExpInt = _;
    const NAN_SIGNIFICAND_BASE: u128 = _;
    const NAN_PAYLOAD_MASK: u128 = _;
    const QNAN_SIGNIFICAND: u128 = _;

    // Provided methods
    fn from_bits(bits: u128) -> IeeeFloat<Self> { ... }
    fn to_bits(x: IeeeFloat<Self>) -> u128 { ... }
}
Expand description

Represents floating point arithmetic semantics.

Required Associated Constants§

Source

const BITS: usize

Total number of bits in the interchange format.

Source

const EXP_BITS: usize

Number of exponent bits in the interchange format.

Provided Associated Constants§

Source

const PRECISION: usize = _

Number of bits in the significand. This includes the integer bit.

Source

const NONFINITE_BEHAVIOR: NonfiniteBehavior = NonfiniteBehavior::IEEE754

How the nonfinite values Inf and NaN are represented.

Source

const MAX_EXP: ExpInt = _

The largest E such that 2^E is representable; this matches the definition of IEEE 754.

Source

const IEEE_MAX_EXP: ExpInt = _

Source

const MIN_EXP: ExpInt = Self::IEEE_MIN_EXP

The smallest E such that 2^E is a normalized number; this matches the definition of IEEE 754.

Source

const IEEE_MIN_EXP: ExpInt = _

Source

const NAN_SIGNIFICAND_BASE: u128 = _

The base significand bitpattern of NaNs, i.e. the bits that must always be set in all NaNs, with other significand bits being either used for payload bits (if NAN_PAYLOAD_MASK covers them) or always unset.

Source

const NAN_PAYLOAD_MASK: u128 = _

The significand bitmask for the payload of a NaN (if supported), including the “quiet bit” (telling QNaNs apart from SNaNs).

Source

const QNAN_SIGNIFICAND: u128 = _

The significand bitpattern to mark a NaN as quiet (if supported).

NOTE: for X87DoubleExtended we need to set two bits instead of one.

NOTE: all NaNs are quiet if unsupported (see NonfiniteBehavior::NanOnly).

Provided Methods§

Source

fn from_bits(bits: u128) -> IeeeFloat<Self>

Source

fn to_bits(x: IeeeFloat<Self>) -> u128

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Semantics for BFloatS

Source§

const BITS: usize = 16usize

Source§

const EXP_BITS: usize = 8usize

Source§

impl Semantics for DoubleS

Source§

const BITS: usize = 64usize

Source§

const EXP_BITS: usize = 11usize

Source§

impl Semantics for Float8E4M3FNS

Source§

const BITS: usize = 8usize

Source§

const EXP_BITS: usize = 4usize

Source§

const NONFINITE_BEHAVIOR: NonfiniteBehavior = NonfiniteBehavior::NanOnly

Source§

impl Semantics for Float8E5M2S

Source§

const BITS: usize = 8usize

Source§

const EXP_BITS: usize = 5usize

Source§

impl Semantics for HalfS

Source§

const BITS: usize = 16usize

Source§

const EXP_BITS: usize = 5usize

Source§

impl Semantics for QuadS

Source§

const BITS: usize = 128usize

Source§

const EXP_BITS: usize = 15usize

Source§

impl Semantics for SingleS

Source§

const BITS: usize = 32usize

Source§

const EXP_BITS: usize = 8usize

Source§

impl Semantics for X87DoubleExtendedS

Source§

const BITS: usize = 80usize

Source§

const EXP_BITS: usize = 15usize

Source§

const PRECISION: usize = 64usize

Source§

const QNAN_SIGNIFICAND: u128 = 13_835_058_055_282_163_712u128

Source§

impl<F: Float> Semantics for FallbackExtendedS<F>

Source§

const BITS: usize = 0usize

Source§

const EXP_BITS: usize = 0usize

Source§

const PRECISION: usize = Fallback<F>::PRECISION

Source§

const MAX_EXP: ExpInt

Source§

const MIN_EXP: ExpInt

Source§

impl<F: Float> Semantics for FallbackS<F>