Struct umath::FFloat

source ·
pub struct FFloat<T>(/* private fields */);
Expand description

Float wrapper that uses ffast-math. This float also implements Ord, Hash, and Eq, as it is not allowed to be NAN.

FFloat<F> is guaranteed to have the same memory layout and ABI as F.

let result = FFloat::new(27.0) * 42109.0;
assert_eq!(*result, 1136943.0);

Safety Notice (for transmuters)

A FFloat is never allowed to be NAN | INF.

Implementations§

source§

impl<T: FastFloat> FFloat<T>

source

pub unsafe fn new(from: T) -> Self

Create a new FFloat from your {f32, f64}.

Safety
// SAFETY: i have verified that 7.0 is infact, not NAN or INF.
let f = unsafe { FFloat::new(7.0) };

Trait Implementations§

source§

impl<T: FastFloat> Add<&FFloat<T>> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the + operator.
source§

fn add(self, FFloat: &FFloat<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FastFloat> Add<&T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FastFloat> Add<T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FastFloat> Add for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the + operator.
source§

fn add(self, FFloat: FFloat<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FastFloat> AddAssign<&FFloat<T>> for FFloat<T>

source§

fn add_assign(&mut self, FFloat: &FFloat<T>)

Performs the += operation. Read more
source§

impl<T: FastFloat> AddAssign<&T> for FFloat<T>

source§

fn add_assign(&mut self, rhs: &T)

Performs the += operation. Read more
source§

impl<T: FastFloat> AddAssign<T> for FFloat<T>

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl<T: FastFloat> AddAssign for FFloat<T>

source§

fn add_assign(&mut self, FFloat: FFloat<T>)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for FFloat<T>

source§

fn clone(&self) -> FFloat<T>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<F: FastFloat + Constants> Constants for FFloat<F>

source§

unsafe fn ε() -> Self

Create a new FFloat representing the machine epsilon.

Safety
source§

unsafe fn π() -> Self

Create a new FFloat representing π.

Safety
source§

unsafe fn e() -> Self

Create a new FFloat representing eulers number.

Safety
source§

impl<F: FastFloat + Constructors> Constructors for FFloat<F>

source§

unsafe fn zero() -> Self

Create a new FFloat representing 0.0.

Safety
source§

unsafe fn one() -> Self

Create a new FFloat representing 1.0.

Safety
source§

unsafe fn min() -> Self

Create a new FFloat representing the minimum value for the inner float.

Safety
source§

unsafe fn max() -> Self

Create a new FFloat representing the maximum value for the inner float.

Safety
source§

impl<T: FastFloat> Debug for FFloat<T>

source§

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

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

impl<T> Deref for FFloat<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> DerefMut for FFloat<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T: FastFloat> Display for FFloat<T>

source§

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

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

impl<T: FastFloat> Div<&FFloat<T>> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the / operator.
source§

fn div(self, FFloat: &FFloat<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FastFloat> Div<&T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FastFloat> Div<T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FastFloat> Div for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the / operator.
source§

fn div(self, FFloat: FFloat<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FastFloat> DivAssign<&FFloat<T>> for FFloat<T>

source§

fn div_assign(&mut self, FFloat: &FFloat<T>)

Performs the /= operation. Read more
source§

impl<T: FastFloat> DivAssign<&T> for FFloat<T>

source§

fn div_assign(&mut self, rhs: &T)

Performs the /= operation. Read more
source§

impl<T: FastFloat> DivAssign<T> for FFloat<T>

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl<T: FastFloat> DivAssign for FFloat<T>

source§

fn div_assign(&mut self, FFloat: FFloat<T>)

Performs the /= operation. Read more
source§

impl<F: FastFloat + Float<F>> Float<F> for FFloat<F>

source§

unsafe fn new(from: F) -> Self

Create a new FFloat from your {f32, f64}

Safety
source§

fn take(self) -> F

Returns this float
source§

impl<F: FloatMethods + FastFloat + Float<F>> FloatMethods for FFloat<F>

source§

fn trunc(self) -> Self

Refer to f32::trunc Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn fract(self) -> Self

Refer to f32::fract Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn abs(self) -> Self

Refer to f32::abs Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

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

Refer to f32::powi Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

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

Refer to f32::powf Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn sqrt(self) -> Self

Refer to f32::sqrt Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn cbrt(self) -> Self

Refer to f32::cbrt Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

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

Refer to f32::hypot Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn exp2(self) -> Self

Refer to f32::exp2 Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

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

Refer to f32::min Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

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

Refer to f32::max Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

impl Hash for FFloat<f32>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Hash for FFloat<f64>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: FastFloat + Trig + Rounding + Log> Log for FFloat<T>

source§

fn log(self, base: Self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn log2(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn log10(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn ln(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

impl<T: FastFloat> Mul<&FFloat<T>> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the * operator.
source§

fn mul(self, FFloat: &FFloat<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FastFloat> Mul<&T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FastFloat> Mul<T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FastFloat> Mul for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the * operator.
source§

fn mul(self, FFloat: FFloat<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FastFloat> MulAssign<&FFloat<T>> for FFloat<T>

source§

fn mul_assign(&mut self, FFloat: &FFloat<T>)

Performs the *= operation. Read more
source§

impl<T: FastFloat> MulAssign<&T> for FFloat<T>

source§

fn mul_assign(&mut self, rhs: &T)

Performs the *= operation. Read more
source§

impl<T: FastFloat> MulAssign<T> for FFloat<T>

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl<T: FastFloat> MulAssign for FFloat<T>

source§

fn mul_assign(&mut self, FFloat: FFloat<T>)

Performs the *= operation. Read more
source§

impl<T: FastFloat> Neg for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T: FastFloat> Ord for FFloat<T>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: FastFloat> PartialEq<T> for FFloat<T>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialEq> PartialEq for FFloat<T>

source§

fn eq(&self, other: &FFloat<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: FastFloat> PartialOrd<T> for FFloat<T>

source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: FastFloat> PartialOrd for FFloat<T>

source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: FastFloat> Rem<&FFloat<T>> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the % operator.
source§

fn rem(self, FFloat: &FFloat<T>) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FastFloat> Rem<&T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &T) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FastFloat> Rem<T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FastFloat> Rem for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the % operator.
source§

fn rem(self, FFloat: FFloat<T>) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FastFloat> RemAssign<&FFloat<T>> for FFloat<T>

source§

fn rem_assign(&mut self, FFloat: &FFloat<T>)

Performs the %= operation. Read more
source§

impl<T: FastFloat> RemAssign<&T> for FFloat<T>

source§

fn rem_assign(&mut self, rhs: &T)

Performs the %= operation. Read more
source§

impl<T: FastFloat> RemAssign<T> for FFloat<T>

source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
source§

impl<T: FastFloat> RemAssign for FFloat<T>

source§

fn rem_assign(&mut self, FFloat: FFloat<T>)

Performs the %= operation. Read more
source§

impl<T: FastFloat + Trig + Rounding + Log> Rounding for FFloat<T>

source§

fn floor(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn ceil(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn round(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

impl<T: FastFloat> Sub<&FFloat<T>> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the - operator.
source§

fn sub(self, FFloat: &FFloat<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FastFloat> Sub<&T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FastFloat> Sub<T> for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FastFloat> Sub for FFloat<T>

§

type Output = FFloat<T>

The resulting type after applying the - operator.
source§

fn sub(self, FFloat: FFloat<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FastFloat> SubAssign<&FFloat<T>> for FFloat<T>

source§

fn sub_assign(&mut self, FFloat: &FFloat<T>)

Performs the -= operation. Read more
source§

impl<T: FastFloat> SubAssign<&T> for FFloat<T>

source§

fn sub_assign(&mut self, rhs: &T)

Performs the -= operation. Read more
source§

impl<T: FastFloat> SubAssign<T> for FFloat<T>

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl<T: FastFloat> SubAssign for FFloat<T>

source§

fn sub_assign(&mut self, FFloat: FFloat<T>)

Performs the -= operation. Read more
source§

impl<T: FastFloat + Trig + Rounding + Log> Trig for FFloat<T>

source§

fn sin(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn asin(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn sinh(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn asinh(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn cos(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn acos(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn cosh(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn acosh(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn tan(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn atan(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

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

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn tanh(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

fn atanh(self) -> Self

Please note that calling this function may (although its dependent on the function) incur UB.

These functions are not marked unsafe, as the entire FFloat type is essentially unsafe.

source§

impl<T: Copy> Copy for FFloat<T>

source§

impl<T: FastFloat> Eq for FFloat<T>

source§

impl<T> StructuralPartialEq for FFloat<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for FFloat<T>where T: RefUnwindSafe,

§

impl<T> Send for FFloat<T>where T: Send,

§

impl<T> Sync for FFloat<T>where T: Sync,

§

impl<T> Unpin for FFloat<T>where T: Unpin,

§

impl<T> UnwindSafe for FFloat<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> FloatAlone for Twhere T: Constants + Add<Output = T> + Sub<Output = T> + PartialEq + Mul<Output = T> + PartialOrd + Rem<Output = T> + Copy + Div<Output = T> + Constructors + Neg<Output = T> + FloatMethods + AddAssign + SubAssign + MulAssign + DivAssign + RemAssign,