pub trait Float<F>:
PartialOrd<F>
+ FloatAlone
+ Add<F, Output = Self>
+ Sub<F, Output = Self>
+ Mul<F, Output = Self>
+ Rem<F, Output = Self>
+ Div<F, Output = Self>
+ AddAssign<F>
+ SubAssign<F>
+ MulAssign<F>
+ DivAssign<F>
+ RemAssign<F>where
Self: Sized,{
// Required methods
unsafe fn new(from: F) -> Self;
fn take(self) -> F;
}
Expand description
Generic float trait, implemented by {FFloat
, f32
, f64
}. Takes a “base” argument, intended to be set to {f32
, f64
}.
The main purpose of this is to be taken (generically) by optionally fast functions.
§Safety
Please note that calling these functions on a FFloat
may incur UB.
These functions are not marked unsafe
, as the entire FFloat
type is essentially unsafe.
Calling these functions on a f32
is perfectly safe, even the unsafe
marked functions (although theres not much point in doing so).
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.