Crate strict_num

Source
Expand description

A collection of bounded numeric types.

Includes:

Unlike f32/f64, all float types implement Ord, PartialOrd and Hash, since it’s guaranteed that they all are finite.

MacrosΒ§

impl_approx_32 πŸ”’
impl_approx_64 πŸ”’
impl_display πŸ”’

StructsΒ§

FiniteF32
An immutable, finite f32.
FiniteF64
An immutable, finite f64.
NonZeroPositiveF32
An immutable, finite f32 that is known to be > 0.
NonZeroPositiveF64
An immutable, finite f64 that is known to be > 0.
NormalizedF32
An immutable, finite f32 in a 0..=1 range.
NormalizedF64
An immutable, finite f64 in a 0..=1 range.
PositiveF32
An immutable, finite f32 that is known to be >= 0.
PositiveF64
An immutable, finite f64 that is known to be >= 0.

TraitsΒ§

ApproxEq
A trait for approximate equality comparisons.
ApproxEqUlps
ApproxEqUlps is a trait for approximate equality comparisons. The associated type Flt is a floating point type which implements Ulps, and is required so that this trait can be implemented for compound types (e.g. vectors), not just for the floats themselves.
Ulps

FunctionsΒ§

clamp_f32 πŸ”’
clamp_f64 πŸ”’