pub struct F32Grid {
pub bit_step: u32,
pub subnormals: Option<SubnormalRange>,
}Expand description
A narrower float format’s grid, laid over the f32 bit pattern.
f32 carries every dtype this exists for exactly, so the grid can be walked there rather than
through the storage type. A value representable in the dtype leaves the low f32 mantissa bits
zero, so one dtype ulp is an increment at that position and the carry into the exponent falls
out on its own. Working in f32 also keeps the grid available to backends with no narrow integer,
and to builds without the fp8 feature.
Fields§
§bit_step: u32One step up in the normal range, as an increment on the f32 bit pattern.
subnormals: Option<SubnormalRange>The dtype’s subnormals, for the formats whose subnormals land in f32’s normal range.
Implementations§
Source§impl F32Grid
impl F32Grid
Sourcepub fn truncate_mask(&self) -> u32
pub fn truncate_mask(&self) -> u32
Clears the mantissa bits the dtype does not carry, truncating a bit pattern onto the grid.
Sourcepub fn round_up_bias(&self) -> u32
pub fn round_up_bias(&self) -> u32
Added to a bit pattern before truncate_mask to turn that truncation
into a round up. The carry it can produce is only safe below the dtype’s maximum, which is
why callers saturate there first.
Trait Implementations§
impl Copy for F32Grid
impl StructuralPartialEq for F32Grid
Auto Trait Implementations§
impl Freeze for F32Grid
impl RefUnwindSafe for F32Grid
impl Send for F32Grid
impl Sync for F32Grid
impl Unpin for F32Grid
impl UnsafeUnpin for F32Grid
impl UnwindSafe for F32Grid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more