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)
Implementations§
source§impl<T: FastFloat> FFloat<T>
impl<T: FastFloat> FFloat<T>
sourcepub unsafe fn new(from: T) -> Self
pub unsafe fn new(from: T) -> Self
Create a new FFloat
from your {f32
, f64
}.
Safety
- You MUST NEVER call this function with
NAN
|INF
- You MUST NEVER make the produced
FFloat
NAN
|INF
- You MUST NEVER combine this or any
FFloat
with any other {FFloat
,f32
,f64
}, if it will produceNAN
|INF
// 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> AddAssign<&FFloat<T>> for FFloat<T>
impl<T: FastFloat> AddAssign<&FFloat<T>> for FFloat<T>
source§fn add_assign(&mut self, FFloat: &FFloat<T>)
fn add_assign(&mut self, FFloat: &FFloat<T>)
+=
operation. Read moresource§impl<T: FastFloat> AddAssign<&T> for FFloat<T>
impl<T: FastFloat> AddAssign<&T> for FFloat<T>
source§fn add_assign(&mut self, rhs: &T)
fn add_assign(&mut self, rhs: &T)
+=
operation. Read moresource§impl<T: FastFloat> AddAssign<T> for FFloat<T>
impl<T: FastFloat> AddAssign<T> for FFloat<T>
source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+=
operation. Read moresource§impl<T: FastFloat> AddAssign for FFloat<T>
impl<T: FastFloat> AddAssign for FFloat<T>
source§fn add_assign(&mut self, FFloat: FFloat<T>)
fn add_assign(&mut self, FFloat: FFloat<T>)
+=
operation. Read moresource§impl<F: FastFloat + Constants> Constants for FFloat<F>
impl<F: FastFloat + Constants> Constants for FFloat<F>
source§impl<F: FastFloat + Constructors> Constructors for FFloat<F>
impl<F: FastFloat + Constructors> Constructors for FFloat<F>
source§impl<T: FastFloat> DivAssign<&FFloat<T>> for FFloat<T>
impl<T: FastFloat> DivAssign<&FFloat<T>> for FFloat<T>
source§fn div_assign(&mut self, FFloat: &FFloat<T>)
fn div_assign(&mut self, FFloat: &FFloat<T>)
/=
operation. Read moresource§impl<T: FastFloat> DivAssign<&T> for FFloat<T>
impl<T: FastFloat> DivAssign<&T> for FFloat<T>
source§fn div_assign(&mut self, rhs: &T)
fn div_assign(&mut self, rhs: &T)
/=
operation. Read moresource§impl<T: FastFloat> DivAssign<T> for FFloat<T>
impl<T: FastFloat> DivAssign<T> for FFloat<T>
source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/=
operation. Read moresource§impl<T: FastFloat> DivAssign for FFloat<T>
impl<T: FastFloat> DivAssign for FFloat<T>
source§fn div_assign(&mut self, FFloat: FFloat<T>)
fn div_assign(&mut self, FFloat: FFloat<T>)
/=
operation. Read moresource§impl<F: FloatMethods + FastFloat + Float<F>> FloatMethods for FFloat<F>
impl<F: FloatMethods + FastFloat + Float<F>> FloatMethods for FFloat<F>
source§fn trunc(self) -> Self
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
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 hypot(self, other: Self) -> Self
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§impl<T: FastFloat + Trig + Rounding + Log> Log for FFloat<T>
impl<T: FastFloat + Trig + Rounding + Log> Log for FFloat<T>
source§fn log(self, base: Self) -> Self
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
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§impl<T: FastFloat> MulAssign<&FFloat<T>> for FFloat<T>
impl<T: FastFloat> MulAssign<&FFloat<T>> for FFloat<T>
source§fn mul_assign(&mut self, FFloat: &FFloat<T>)
fn mul_assign(&mut self, FFloat: &FFloat<T>)
*=
operation. Read moresource§impl<T: FastFloat> MulAssign<&T> for FFloat<T>
impl<T: FastFloat> MulAssign<&T> for FFloat<T>
source§fn mul_assign(&mut self, rhs: &T)
fn mul_assign(&mut self, rhs: &T)
*=
operation. Read moresource§impl<T: FastFloat> MulAssign<T> for FFloat<T>
impl<T: FastFloat> MulAssign<T> for FFloat<T>
source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*=
operation. Read moresource§impl<T: FastFloat> MulAssign for FFloat<T>
impl<T: FastFloat> MulAssign for FFloat<T>
source§fn mul_assign(&mut self, FFloat: FFloat<T>)
fn mul_assign(&mut self, FFloat: FFloat<T>)
*=
operation. Read moresource§impl<T: FastFloat> Ord for FFloat<T>
impl<T: FastFloat> Ord for FFloat<T>
source§impl<T: PartialEq> PartialEq for FFloat<T>
impl<T: PartialEq> PartialEq for FFloat<T>
source§impl<T: FastFloat> PartialOrd<T> for FFloat<T>
impl<T: FastFloat> PartialOrd<T> for FFloat<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<T: FastFloat> PartialOrd for FFloat<T>
impl<T: FastFloat> PartialOrd for FFloat<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<T: FastFloat> RemAssign<&FFloat<T>> for FFloat<T>
impl<T: FastFloat> RemAssign<&FFloat<T>> for FFloat<T>
source§fn rem_assign(&mut self, FFloat: &FFloat<T>)
fn rem_assign(&mut self, FFloat: &FFloat<T>)
%=
operation. Read moresource§impl<T: FastFloat> RemAssign<&T> for FFloat<T>
impl<T: FastFloat> RemAssign<&T> for FFloat<T>
source§fn rem_assign(&mut self, rhs: &T)
fn rem_assign(&mut self, rhs: &T)
%=
operation. Read moresource§impl<T: FastFloat> RemAssign<T> for FFloat<T>
impl<T: FastFloat> RemAssign<T> for FFloat<T>
source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%=
operation. Read moresource§impl<T: FastFloat> RemAssign for FFloat<T>
impl<T: FastFloat> RemAssign for FFloat<T>
source§fn rem_assign(&mut self, FFloat: FFloat<T>)
fn rem_assign(&mut self, FFloat: FFloat<T>)
%=
operation. Read moresource§impl<T: FastFloat + Trig + Rounding + Log> Rounding for FFloat<T>
impl<T: FastFloat + Trig + Rounding + Log> Rounding for FFloat<T>
source§fn floor(self) -> Self
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§impl<T: FastFloat> SubAssign<&FFloat<T>> for FFloat<T>
impl<T: FastFloat> SubAssign<&FFloat<T>> for FFloat<T>
source§fn sub_assign(&mut self, FFloat: &FFloat<T>)
fn sub_assign(&mut self, FFloat: &FFloat<T>)
-=
operation. Read moresource§impl<T: FastFloat> SubAssign<&T> for FFloat<T>
impl<T: FastFloat> SubAssign<&T> for FFloat<T>
source§fn sub_assign(&mut self, rhs: &T)
fn sub_assign(&mut self, rhs: &T)
-=
operation. Read moresource§impl<T: FastFloat> SubAssign<T> for FFloat<T>
impl<T: FastFloat> SubAssign<T> for FFloat<T>
source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-=
operation. Read moresource§impl<T: FastFloat> SubAssign for FFloat<T>
impl<T: FastFloat> SubAssign for FFloat<T>
source§fn sub_assign(&mut self, FFloat: FFloat<T>)
fn sub_assign(&mut self, FFloat: FFloat<T>)
-=
operation. Read moresource§impl<T: FastFloat + Trig + Rounding + Log> Trig for FFloat<T>
impl<T: FastFloat + Trig + Rounding + Log> Trig for FFloat<T>
source§fn sin(self) -> Self
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
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
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
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
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
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
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
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
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
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
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.