Skip to main content

F8

Struct F8 

Source
#[repr(transparent)]
pub struct F8(pub u8);
Expand description

Finite-only 8-bit float: E4M3 with the top exponent reserved for NaN.

Tuple Fields§

§0: u8

Implementations§

Source§

impl F8

Source

pub fn to_f32(self) -> f32

Convert to f32 exactly.

Source

pub fn from_f32(val: f32) -> F8

Convert from f32 with round-to-nearest, ties-to-even.

Infinity and finite overflow saturate to the signed maximum finite value. NaN maps to the canonical all-ones magnitude encoding.

Trait Implementations§

Source§

impl Add for F8

Source§

type Output = F8

The resulting type after applying the + operator.
Source§

fn add(self, rhs: F8) -> F8

Performs the + operation. Read more
Source§

impl AddAssign for F8

Source§

fn add_assign(&mut self, rhs: F8)

Performs the += operation. Read more
Source§

impl CastFrom<Bf4> for F8

Source§

fn cast_from(val: Bf4) -> F8

Cast from type T to Self.
Source§

impl CastFrom<Bf8> for F8

Source§

fn cast_from(val: Bf8) -> F8

Cast from type T to Self.
Source§

impl CastFrom<Bf16> for F8

Source§

fn cast_from(val: Bf16) -> F8

Cast from type T to Self.
Source§

impl CastFrom<F4> for F8

Source§

fn cast_from(val: F4) -> F8

Cast from type T to Self.
Source§

impl CastFrom<F8> for f32

Source§

fn cast_from(val: F8) -> f32

Cast from type T to Self.
Source§

impl CastFrom<F8> for f64

Source§

fn cast_from(val: F8) -> f64

Cast from type T to Self.
Source§

impl CastFrom<F8> for i8

Source§

fn cast_from(val: F8) -> i8

Cast from type T to Self.
Source§

impl CastFrom<F8> for i16

Source§

fn cast_from(val: F8) -> i16

Cast from type T to Self.
Source§

impl CastFrom<F8> for i32

Source§

fn cast_from(val: F8) -> i32

Cast from type T to Self.
Source§

impl CastFrom<F8> for usize

Source§

fn cast_from(val: F8) -> usize

Cast from type T to Self.
Source§

impl CastFrom<F8> for I8

Source§

fn cast_from(val: F8) -> I8

Cast from type T to Self.
Source§

impl CastFrom<F8> for I16

Source§

fn cast_from(val: F8) -> I16

Cast from type T to Self.
Source§

impl CastFrom<F8> for I32

Source§

fn cast_from(val: F8) -> I32

Cast from type T to Self.
Source§

impl CastFrom<F8> for F16

Source§

fn cast_from(val: F8) -> F16

Cast from type T to Self.
Source§

impl CastFrom<F8> for F32

Source§

fn cast_from(val: F8) -> F32

Cast from type T to Self.
Source§

impl CastFrom<F8> for F64

Source§

fn cast_from(val: F8) -> F64

Cast from type T to Self.
Source§

impl CastFrom<F8> for Bf16

Source§

fn cast_from(val: F8) -> Bf16

Cast from type T to Self.
Source§

impl CastFrom<F8> for Bf8

Source§

fn cast_from(val: F8) -> Bf8

Cast from type T to Self.
Source§

impl CastFrom<F8> for Bf4

Source§

fn cast_from(val: F8) -> Bf4

Cast from type T to Self.
Source§

impl CastFrom<F8> for F4

Source§

fn cast_from(val: F8) -> F4

Cast from type T to Self.
Source§

impl CastFrom<F8> for F8

Source§

fn cast_from(val: F8) -> F8

Cast from type T to Self.
Source§

impl CastFrom<F16> for F8

Source§

fn cast_from(val: F16) -> F8

Cast from type T to Self.
Source§

impl CastFrom<F32> for F8

Source§

fn cast_from(val: F32) -> F8

Cast from type T to Self.
Source§

impl CastFrom<F64> for F8

Source§

fn cast_from(val: F64) -> F8

Cast from type T to Self.
Source§

impl CastFrom<I8> for F8

Source§

fn cast_from(val: I8) -> F8

Cast from type T to Self.
Source§

impl CastFrom<I16> for F8

Source§

fn cast_from(val: I16) -> F8

Cast from type T to Self.
Source§

impl CastFrom<I32> for F8

Source§

fn cast_from(val: I32) -> F8

Cast from type T to Self.
Source§

impl CastFrom<f32> for F8

Source§

fn cast_from(val: f32) -> F8

Cast from type T to Self.
Source§

impl CastFrom<f64> for F8

Source§

fn cast_from(val: f64) -> F8

Cast from type T to Self.
Source§

impl CastFrom<i8> for F8

Source§

fn cast_from(val: i8) -> F8

Cast from type T to Self.
Source§

impl CastFrom<i16> for F8

Source§

fn cast_from(val: i16) -> F8

Cast from type T to Self.
Source§

impl CastFrom<i32> for F8

Source§

fn cast_from(val: i32) -> F8

Cast from type T to Self.
Source§

impl Clone for F8

Source§

fn clone(&self) -> F8

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for F8

Source§

impl Debug for F8

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for F8

Source§

fn default() -> F8

Returns the “default value” for a type. Read more
Source§

impl Div for F8

Source§

type Output = F8

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F8) -> F8

Performs the / operation. Read more
Source§

impl FloatElement for F8

Source§

fn from_f32(val: f32) -> F8

Convert from f32.
Source§

fn from_f64(val: f64) -> F8

Convert from f64.
Source§

fn to_f32(self) -> f32

Cast to f32.
Source§

fn exp(self) -> Self

e^self.
Source§

fn ln(self) -> Self

Natural logarithm.
Source§

fn sin(self) -> Self

Sine (radians).
Source§

fn cos(self) -> Self

Cosine (radians).
Source§

fn acos(self) -> Self

Inverse cosine (radians).
Source§

fn tan(self) -> Self

Tangent (radians).
Source§

fn sinh(self) -> Self

Hyperbolic sine.
Source§

fn cosh(self) -> Self

Hyperbolic cosine.
Source§

fn tanh(self) -> Self

Hyperbolic tangent.
Source§

fn atan2(self, other: Self) -> Self

Four-quadrant arctangent of self / other.
Source§

fn powf(self, n: Self) -> Self

self raised to the power n.
Source§

fn recip(self) -> Self

Reciprocal 1 / self.
Source§

fn floor(self) -> Self

Largest integer ≤ self.
Source§

fn ceil(self) -> Self

Smallest integer ≥ self.
Source§

fn round(self) -> Self

Nearest integer, half away from zero.
Source§

fn trunc(self) -> Self

Integer part (toward zero).
Source§

fn signum(self) -> Self

Sign of self: 1 for positive/+0, -1 for negative/-0, NaN for NaN (matching f64::signum / num_traits::Float::signum).
Source§

fn powi(self, n: i32) -> Self

self raised to an integer power via exponentiation by squaring. Read more
Source§

fn log10(self) -> Self

Base-10 logarithm, log₁₀(self). Read more
Source§

fn log2(self) -> Self

Base-2 logarithm, log₂(self). Read more
Source§

fn erf(self) -> Self

Error function erf(self) = 2/√π ∫₀ˢᵉˡᶠ e^(-t²) dt. Read more
Source§

fn erfc(self) -> Self

Complementary error function erfc(self) = 1 - erf(self), computed without the cancellation error of 1 - erf for large self.
Source§

fn lgamma(self) -> Self

Natural logarithm of the absolute value of the gamma function, ln|Γ(self)|.
Source§

fn default_epsilon() -> Self
where Self: RealField,

Machine epsilon (nalgebra::RealField::default_epsilon compatibility alias). Read more
Source§

fn pi() -> Self
where Self: RealField,

Returns π as this float type (nalgebra compatibility alias for RealField::PI).
Source§

fn max(self, other: Self) -> Self

Componentwise maximum (method form; prefer NumericElement::max_scalar in new code).
Source§

fn min(self, other: Self) -> Self

Componentwise minimum (method form; prefer NumericElement::min_scalar in new code).
Source§

fn norm(self) -> Self

L2 (Euclidean) norm — for scalars this is the absolute value.
Source§

impl Mul for F8

Source§

type Output = F8

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F8) -> F8

Performs the * operation. Read more
Source§

impl MulAssign for F8

Source§

fn mul_assign(&mut self, rhs: F8)

Performs the *= operation. Read more
Source§

impl Neg for F8

Source§

type Output = F8

The resulting type after applying the - operator.
Source§

fn neg(self) -> F8

Performs the unary - operation. Read more
Source§

impl NumericElement for F8

Source§

const ZERO: F8

Additive identity.
Source§

const ONE: F8

Multiplicative identity.
Source§

const NAN: F8

IEEE 754 not-a-number sentinel.
Source§

const INFINITY: F8

IEEE 754 positive infinity.
Source§

const MIN_VALUE: F8

The minimum representable finite value (negative infinity or i32::MIN). Read more
Source§

const MAX_VALUE: F8

The maximum representable finite value (positive infinity or i32::MAX). Read more
Source§

const BYTE_WIDTH: usize = 1

Number of bytes per element.
Source§

const ALL_ONES: F8

Bitwise representation with all bits set to 1.
Source§

const SIGN_MASK: F8

IEEE 754 sign-bit mask: only the most-significant bit is set. Read more
Source§

fn abs(self) -> F8

Absolute value.
Source§

fn scalar_fmadd(self, b: F8, c: F8) -> F8

Scalar fused multiply-add: (self * b) + c.
Source§

fn sqrt(self) -> F8

Square root. Floats follow IEEE 754 (NaN for negative inputs); integers return the exact floor integer square root (isqrt), with negative signed inputs defined to return 0 (integers have no NaN to signal the domain error). No f64 round-trip, so the integer result is exact for all operands.
Source§

fn is_finite(self) -> bool

Returns true if finite.
Source§

fn is_nan(self) -> bool

Returns true if NaN.
Source§

fn to_f64(self) -> f64

Cast to f64.
Source§

fn bitand(self, rhs: F8) -> F8

Bitwise AND.
Source§

fn bitor(self, rhs: F8) -> F8

Bitwise OR.
Source§

fn bitxor(self, rhs: F8) -> F8

Bitwise XOR.
Source§

fn count_ones(self) -> u32

Count set bits (population count).
Source§

fn min_scalar(self, other: Self) -> Self
where Self: PartialOrd,

Elementwise minimum: returns self if self <= other, else other. Read more
Source§

fn max_scalar(self, other: Self) -> Self
where Self: PartialOrd,

Elementwise maximum: returns self if self >= other, else other. Read more
Source§

fn saturating_add(self, rhs: Self) -> Self

Saturating addition. Read more
Source§

fn saturating_mul(self, rhs: Self) -> Self

Saturating multiplication. Read more
Source§

fn checked_add(self, rhs: Self) -> Option<Self>

Checked addition: returns Some(self + rhs) or None on integer overflow. Read more
Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Checked multiplication: returns Some(self * rhs) or None on integer overflow. Read more
Source§

impl PartialEq for F8

Source§

fn eq(&self, other: &F8) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for F8

Source§

fn partial_cmp(&self, other: &F8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Pod for F8

Source§

impl Pod for F8

Source§

impl Rem for F8

Source§

type Output = F8

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: F8) -> F8

Performs the % operation. Read more
Source§

impl RemAssign for F8

Source§

fn rem_assign(&mut self, rhs: F8)

Performs the %= operation. Read more
Source§

impl StructuralPartialEq for F8

Source§

impl Sub for F8

Source§

type Output = F8

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: F8) -> F8

Performs the - operation. Read more
Source§

impl SubAssign for F8

Source§

fn sub_assign(&mut self, rhs: F8)

Performs the -= operation. Read more
Source§

impl UnitScalar for F8

Source§

fn scale_by_f64(self, factor: f64) -> F8

Scale this value by a real coefficient in the scalar’s native precision.
Source§

impl Zeroable for F8

Source§

fn zeroed() -> Self

Returns a value of Self with every byte set to zero.
Source§

impl Zeroable for F8

Source§

fn zeroed() -> Self

Auto Trait Implementations§

§

impl Freeze for F8

§

impl RefUnwindSafe for F8

§

impl Send for F8

§

impl Sync for F8

§

impl Unpin for F8

§

impl UnsafeUnpin for F8

§

impl UnwindSafe for F8

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CastTo for T
where T: Copy,

Source§

fn cast_to<U>(self) -> U
where U: CastFrom<Self>,

Cast self to type U.
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> NoUninit for T
where T: Pod,

Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.