Trait Float

Source
pub trait Float {
    const MANTISSA_BITS: usize;
    const EXP_BITS: usize;
    const EMAX: i32 = _;

    // Required method
    fn from_fp(neg: bool, mantissa: u64, exp2: u32) -> Self;
}
Expand description

A trait for IEEE754 floating point numbers.

Required Associated Constants§

Source

const MANTISSA_BITS: usize

The bit length of mantissa part.

Source

const EXP_BITS: usize

The bit length of exponent part.

Provided Associated Constants§

Source

const EMAX: i32 = _

The exponent bias (the default is (1 << (Self::EXP_BITS - 1)) - 1).

Required Methods§

Source

fn from_fp(neg: bool, mantissa: u64, exp2: u32) -> Self

Produce the float from a sign, a mantissa, and a biased exponent.

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.

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

const MANTISSA_BITS: usize = 23usize

Source§

const EXP_BITS: usize = 8usize

Source§

fn from_fp(neg: bool, mantissa: u64, exp2: u32) -> Self

Source§

impl Float for f64

Source§

const MANTISSA_BITS: usize = 52usize

Source§

const EXP_BITS: usize = 11usize

Source§

fn from_fp(neg: bool, mantissa: u64, exp2: u32) -> Self

Implementors§