Trait numcodecs_linear_quantize::Float

source ·
pub trait Float:
    Copy
    + Serialize
    + DeserializeOwned
    + Sub<Self, Output = Self>
    + Div<Self, Output = Self>
    + Add<Self, Output = Self>
    + Mul<Self, Output = Self>
    + PartialEq {
    const ZERO: Self;
    const ONE: Self;

    // Required methods
    fn minimum(self, other: Self) -> Self;
    fn maximum(self, other: Self) -> Self;
    fn clamp(self, min: Self, max: Self) -> Self;
    fn scale_for_bits(bits: u8) -> Self;
    fn is_finite(self) -> bool;
}
Expand description

Floating point types.

Required Associated Constants§

source

const ZERO: Self

0.0

source

const ONE: Self

1.0

Required Methods§

source

fn minimum(self, other: Self) -> Self

Returns the minimum of the two numbers, ignoring NaN.

source

fn maximum(self, other: Self) -> Self

Returns the maximum of the two numbers, ignoring NaN.

source

fn clamp(self, min: Self, max: Self) -> Self

Restrict a value to a certain interval unless it is NaN.

source

fn scale_for_bits(bits: u8) -> Self

Returns exp2(bits) - 1.0

source

fn is_finite(self) -> bool

Returns true if this number is neither infinite nor NaN.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Float for f32

source§

const ONE: Self = 1f32

source§

const ZERO: Self = 0f32

source§

fn minimum(self, other: Self) -> Self

source§

fn maximum(self, other: Self) -> Self

source§

fn clamp(self, min: Self, max: Self) -> Self

source§

fn scale_for_bits(bits: u8) -> Self

source§

fn is_finite(self) -> bool

source§

impl Float for f64

source§

const ONE: Self = 1f64

source§

const ZERO: Self = 0f64

source§

fn minimum(self, other: Self) -> Self

source§

fn maximum(self, other: Self) -> Self

source§

fn clamp(self, min: Self, max: Self) -> Self

source§

fn scale_for_bits(bits: u8) -> Self

source§

fn is_finite(self) -> bool

Implementors§