Trait vortex_alp::ALPFloat

source ·
pub trait ALPFloat:
    Sealed
    + Float
    + Display
    + 'static {
    type ALPInt: PrimInt + Display + ToPrimitive;

    const FRACTIONAL_BITS: u8;
    const MAX_EXPONENT: u8;
    const SWEET: Self;
    const F10: &'static [Self];
    const IF10: &'static [Self];

    // Required methods
    fn as_int(self) -> Self::ALPInt;
    fn from_int(n: Self::ALPInt) -> Self;

    // Provided methods
    fn fast_round(self) -> Self { ... }
    fn find_best_exponents(values: &[Self]) -> Exponents { ... }
    fn estimate_encoded_size(
        encoded: &[Self::ALPInt],
        patches: &[Self],
    ) -> usize { ... }
    fn encode(
        values: &[Self],
        exponents: Option<Exponents>,
    ) -> (Exponents, Vec<Self::ALPInt>, Vec<u64>, Vec<Self>) { ... }
    fn encode_single(
        value: Self,
        exponents: Exponents,
    ) -> Result<Self::ALPInt, Self> { ... }
    fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self> { ... }
    fn decode_vec(encoded: Vec<Self::ALPInt>, exponents: Exponents) -> Vec<Self> { ... }
    fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self { ... }
    unsafe fn encode_single_unchecked(
        value: Self,
        exponents: Exponents,
    ) -> Self::ALPInt { ... }
}

Required Associated Types§

Required Associated Constants§

source

const FRACTIONAL_BITS: u8

source

const MAX_EXPONENT: u8

source

const SWEET: Self

source

const F10: &'static [Self]

source

const IF10: &'static [Self]

Required Methods§

source

fn as_int(self) -> Self::ALPInt

Equivalent to calling as to cast the primitive float to the target integer type.

source

fn from_int(n: Self::ALPInt) -> Self

Convert from the integer type back to the float type using as.

Provided Methods§

source

fn fast_round(self) -> Self

Round to the nearest floating integer by shifting in and out of the low precision range.

source

fn find_best_exponents(values: &[Self]) -> Exponents

source

fn estimate_encoded_size(encoded: &[Self::ALPInt], patches: &[Self]) -> usize

source

fn encode( values: &[Self], exponents: Option<Exponents>, ) -> (Exponents, Vec<Self::ALPInt>, Vec<u64>, Vec<Self>)

source

fn encode_single( value: Self, exponents: Exponents, ) -> Result<Self::ALPInt, Self>

source

fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self>

source

fn decode_vec(encoded: Vec<Self::ALPInt>, exponents: Exponents) -> Vec<Self>

source

fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self

source

unsafe fn encode_single_unchecked( value: Self, exponents: Exponents, ) -> Self::ALPInt

§Safety

The returned value may not decode back to the original value.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ALPFloat for f32

source§

type ALPInt = i32

source§

const FRACTIONAL_BITS: u8 = 23u8

source§

const MAX_EXPONENT: u8 = 10u8

source§

const SWEET: Self = 12582912f32

source§

const F10: &'static [Self] = _

source§

const IF10: &'static [Self] = _

source§

fn as_int(self) -> Self::ALPInt

source§

fn from_int(n: Self::ALPInt) -> Self

source§

impl ALPFloat for f64

source§

type ALPInt = i64

source§

const FRACTIONAL_BITS: u8 = 52u8

source§

const MAX_EXPONENT: u8 = 18u8

source§

const SWEET: Self = 6755399441055744f64

source§

const F10: &'static [Self] = _

source§

const IF10: &'static [Self] = _

source§

fn as_int(self) -> Self::ALPInt

source§

fn from_int(n: Self::ALPInt) -> Self

Implementors§