[][src]Trait compiler_builtins::float::Float

pub trait Float: Copy + PartialEq + PartialOrd + AddAssign + MulAssign + Add<Output = Self> + Sub<Output = Self> + Div<Output = Self> + Rem<Output = Self> {
    type Int: Int;
    type SignedInt: Int;

    const ZERO: Self;
    const ONE: Self;
    const BITS: u32;
    const SIGNIFICAND_BITS: u32;
    const EXPONENT_BITS: u32;
    const EXPONENT_MAX: u32;
    const EXPONENT_BIAS: u32;
    const SIGN_MASK: Self::Int;
    const SIGNIFICAND_MASK: Self::Int;
    const IMPLICIT_BIT: Self::Int;
    const EXPONENT_MASK: Self::Int;

    fn repr(self) -> Self::Int;
fn signed_repr(self) -> Self::SignedInt;
fn from_repr(a: Self::Int) -> Self;
fn from_parts(
        sign: bool,
        exponent: Self::Int,
        significand: Self::Int
    ) -> Self;
fn normalize(significand: Self::Int) -> (i32, Self::Int); }

Trait for some basic operations on floats

Associated Types

type Int: Int

A uint of the same with as the float

type SignedInt: Int

A int of the same with as the float

Loading content...

Associated Constants

const ZERO: Self

const ONE: Self

const BITS: u32

The bitwidth of the float type

const SIGNIFICAND_BITS: u32

The bitwidth of the significand

const EXPONENT_BITS: u32

The bitwidth of the exponent

const EXPONENT_MAX: u32

The maximum value of the exponent

const EXPONENT_BIAS: u32

The exponent bias value

const SIGN_MASK: Self::Int

A mask for the sign bit

const SIGNIFICAND_MASK: Self::Int

A mask for the significand

const IMPLICIT_BIT: Self::Int

const EXPONENT_MASK: Self::Int

A mask for the exponent

Loading content...

Required methods

fn repr(self) -> Self::Int

Returns self transmuted to Self::Int

fn signed_repr(self) -> Self::SignedInt

Returns self transmuted to Self::SignedInt

fn from_repr(a: Self::Int) -> Self

Returns a Self::Int transmuted back to Self

fn from_parts(sign: bool, exponent: Self::Int, significand: Self::Int) -> Self

Constructs a Self from its parts. Inputs are treated as bits and shifted into position.

fn normalize(significand: Self::Int) -> (i32, Self::Int)

Returns (normalized exponent, normalized significand)

Loading content...

Implementors

impl Float for f32[src]

type Int = u32

type SignedInt = i32

impl Float for f64[src]

type Int = u64

type SignedInt = i64

Loading content...