pub struct Fp16;Expand description
IEEE-754 binary16 (“half”): 1 sign, 5 exponent, 10 mantissa, bias 15. Has inf and NaN.
For a faster, inf/NaN-unchecked variant of the same layout see Fp16Fast.
Trait Implementations§
impl Copy for Fp16
impl Eq for Fp16
Source§impl FloatSpec for Fp16
impl FloatSpec for Fp16
Source§const MANTISSA_BITS: u32 = 10
const MANTISSA_BITS: u32 = 10
Width of the (stored, fractional) mantissa field in bits.
Source§const EXP_BIAS: i32 = 15
const EXP_BIAS: i32 = 15
Exponent bias (subtracted from the stored exponent to get the true exponent).
Source§const SPECIAL: SpecialEncoding = SpecialEncoding::Ieee
const SPECIAL: SpecialEncoding = SpecialEncoding::Ieee
How the maximum-exponent code points encode inf / NaN.
Source§const SIGN_SHIFT: u32 = _
const SIGN_SHIFT: u32 = _
Bit position of the sign (and of the field block:
exp occupies
MANTISSA_BITS .. SIGN_SHIFT).Source§const STORAGE_MASK: u32 = _
const STORAGE_MASK: u32 = _
Mask of the significant bits within the
u32 working register ((1 << BITS) - 1).Source§const EXP_FIELD_MAX: u32 = _
const EXP_FIELD_MAX: u32 = _
All-ones exponent field value (
(1 << EXP_BITS) - 1).Source§const MANTISSA_MASK: u32 = _
const MANTISSA_MASK: u32 = _
Mask isolating the mantissa field.
Source§const MANTISSA_SHIFT: u32 = _
const MANTISSA_SHIFT: u32 = _
Bits the mantissa shifts when aligning to / from
f32’s 23-bit field
(F32_MANTISSA_BITS - MANTISSA_BITS). Requires MANTISSA_BITS <= 23 (true for every
sub-f32 format).Source§const EXP_REBIAS: i32 = _
const EXP_REBIAS: i32 = _
Added to the stored exponent going packed ->
f32 (subtracted the other way):
F32_EXP_BIAS - EXP_BIAS.Source§const MAX_FINITE_EXP_FIELD: u32 = _
const MAX_FINITE_EXP_FIELD: u32 = _
Largest exponent field that still denotes a finite number on the pack (encode) side.
For
SpecialEncoding::Ieee and Unchecked the all-ones
field is the reserved inf/NaN code point, so this is EXP_FIELD_MAX - 1; for the
no-reserved-code-point schemes it is EXP_FIELD_MAX. (Note Unchecked unpack still
decodes the all-ones exponent as a large normal - it only matters here that an input which
would round up onto that reserved code point overflows, and so flushes to zero, matching
the hardware vcvtps2ph + flush path.)Source§const MAX_FINITE_BITS: u32 = _
const MAX_FINITE_BITS: u32 = _
Bit pattern (sign clear) of the largest finite magnitude - the saturation target.
Source§const INFINITY_BITS: u32 = Self::EXP_MASK
const INFINITY_BITS: u32 = Self::EXP_MASK
Source§const NAN_BITS: u32 = _
const NAN_BITS: u32 = _
Canonical quiet-NaN bit pattern (sign clear). Meaningful unless the format has no NaN
(
SpecialEncoding::Finite).Source§const OVERFLOW_BITS: u32 = _
const OVERFLOW_BITS: u32 = _
Result (sign clear) when a magnitude exceeds the finite range:
±inf for IEEE formats,
saturation to the largest finite for the no-inf schemes, and signed zero for Unchecked
(which flushes overflow). Used for both overflow of a finite input and for an f32
infinity input.Source§const NAN_OUT_BITS: u32 = _
const NAN_OUT_BITS: u32 = _
Result (sign clear) for an
f32 NaN input: the canonical NaN for formats that have one,
saturation for SpecialEncoding::Finite (no NaN code point), and signed zero for
Unchecked (which flushes NaN).Source§impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V1, 2>> for U16x8V1
Available on x86 or x86-64 only.
impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V1, 2>> for U16x8V1
Available on x86 or x86-64 only.
Source§impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V1, 4>> for ArrayRegister<U16x8V1, 2>
Available on x86 or x86-64 only.
impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V1, 4>> for ArrayRegister<U16x8V1, 2>
Available on x86 or x86-64 only.
Source§impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V2, 2>> for U16x8V2
Available on x86 or x86-64 only.
impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V2, 2>> for U16x8V2
Available on x86 or x86-64 only.
Source§impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V2, 4>> for ArrayRegister<U16x8V2, 2>
Available on x86 or x86-64 only.
impl PackedFloatRegister<Fp16, ArrayRegister<F32x4V2, 4>> for ArrayRegister<U16x8V2, 2>
Available on x86 or x86-64 only.
Source§impl PackedFloatRegister<Fp16, ArrayRegister<F32x8V3, 2>> for U16x16V3
Available on crate feature avx2-f16c and (x86 or x86-64) only.
impl PackedFloatRegister<Fp16, ArrayRegister<F32x8V3, 2>> for U16x16V3
Available on crate feature
avx2-f16c and (x86 or x86-64) only.Source§impl PackedFloatRegister<Fp16, F32x4V3> for U16x4V3
Available on crate feature avx2-f16c and (x86 or x86-64) only.
impl PackedFloatRegister<Fp16, F32x4V3> for U16x4V3
Available on crate feature
avx2-f16c and (x86 or x86-64) only.Source§impl PackedFloatRegister<Fp16, F32x8V3> for U16x8V3
Available on crate feature avx2-f16c and (x86 or x86-64) only.
impl PackedFloatRegister<Fp16, F32x8V3> for U16x8V3
Available on crate feature
avx2-f16c and (x86 or x86-64) only.impl StructuralPartialEq for Fp16
Auto Trait Implementations§
impl Freeze for Fp16
impl RefUnwindSafe for Fp16
impl Send for Fp16
impl Sync for Fp16
impl Unpin for Fp16
impl UnsafeUnpin for Fp16
impl UnwindSafe for Fp16
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.