Struct ScaledFloat
pub struct ScaledFloat(/* private field */);
An unsigned integer scaled version of a floating point value, equivalent to an integer quotient with [fixed denominator][ScaledFloat::SCALING]).
Implementations
impl ScaledFloat
const SCALING: f32 = 100_000.0;fn in_range(value: f32) -> boolGets whether the value is within the clamped range of this type.
fn exact(value: f32) -> boolGets whether the value can be exactly converted in round-trip.
fn new(value: f32) -> SelfSlightly inaccurate scaling and quantization. Clamps the value into the representable range if it is negative or too large.
fn from_scaled(val: u32) -> SelfFully accurate construction from a value scaled as per specification.
fn into_scaled(self) -> u32Get the accurate encoded value.
fn into_value(self) -> f32Get the unscaled value as a floating point.
Trait Implementations
impl Clone for ScaledFloat
fn clone(&self) -> Self
impl Copy for ScaledFloat
impl Debug for ScaledFloat
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for ScaledFloat
impl PartialEq for ScaledFloat
fn eq(&self, other: &Self) -> bool