Skip to main content

Scalar

Trait Scalar 

Source
pub trait Scalar:
    Sized
    + Float
    + NumCast
    + FloatConst
    + Display
    + Debug
    + Trig
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign {
Show 16 associated constants and 2 methods const HALF: Self; const ZERO: Self; const ONE: Self; const TWO: Self; const THREE: Self; const FOUR: Self; const FIVE: Self; const SIX: Self; const SEVEN: Self; const EIGHT: Self; const NINE: Self; const TEN: Self; const MIN: Self; const MAX: Self; const EPSILON: Self; const DIV_EPSILON: Self = Self::EPSILON; // Required method fn value(v: f32) -> Self; // Provided method fn epsilon_for(_reference: Self) -> Self { ... }
}

Required Associated Constants§

Source

const HALF: Self

Source

const ZERO: Self

Source

const ONE: Self

Source

const TWO: Self

Source

const THREE: Self

Source

const FOUR: Self

Source

const FIVE: Self

Source

const SIX: Self

Source

const SEVEN: Self

Source

const EIGHT: Self

Source

const NINE: Self

Source

const TEN: Self

Source

const MIN: Self

Source

const MAX: Self

Source

const EPSILON: Self

Provided Associated Constants§

Source

const DIV_EPSILON: Self = Self::EPSILON

Required Methods§

Source

fn value(v: f32) -> Self

Provided Methods§

Source

fn epsilon_for(_reference: Self) -> Self

Epsilon constants are usually not a good way to deal with float precision. Float precision depends on the magnitude of the values and so should appropriate epsilons.

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 Scalar for f32

Source§

const HALF: f32 = 0.5

Source§

const ZERO: f32 = 0.0

Source§

const ONE: f32 = 1.0

Source§

const TWO: f32 = 2.0

Source§

const THREE: f32 = 3.0

Source§

const FOUR: f32 = 4.0

Source§

const FIVE: f32 = 5.0

Source§

const SIX: f32 = 6.0

Source§

const SEVEN: f32 = 7.0

Source§

const EIGHT: f32 = 8.0

Source§

const NINE: f32 = 9.0

Source§

const TEN: f32 = 10.0

Source§

const MIN: f32 = f32::MIN

Source§

const MAX: f32 = f32::MAX

Source§

const EPSILON: f32 = 1e-4

Source§

fn epsilon_for(reference: f32) -> f32

Source§

fn value(v: f32) -> f32

Source§

impl Scalar for f64

Source§

const HALF: f64 = 0.5

Source§

const ZERO: f64 = 0.0

Source§

const ONE: f64 = 1.0

Source§

const TWO: f64 = 2.0

Source§

const THREE: f64 = 3.0

Source§

const FOUR: f64 = 4.0

Source§

const FIVE: f64 = 5.0

Source§

const SIX: f64 = 6.0

Source§

const SEVEN: f64 = 7.0

Source§

const EIGHT: f64 = 8.0

Source§

const NINE: f64 = 9.0

Source§

const TEN: f64 = 10.0

Source§

const MIN: f64 = f64::MIN

Source§

const MAX: f64 = f64::MAX

Source§

const EPSILON: f64 = 1e-8

Source§

fn epsilon_for(reference: f64) -> f64

Source§

fn value(v: f32) -> f64

Implementors§