pub trait Float:
Copy
+ 'static
+ PartialOrd
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Neg<Output = Self> {
const ZERO: Self;
const ONE: Self;
const MIN_POSITIVE: Self;
Show 16 methods
// Required methods
fn from_f64(v: f64) -> Self;
fn powf(self, exp: Self) -> Self;
fn cbrt(self) -> Self;
fn sqrt(self) -> Self;
fn ln(self) -> Self;
fn exp(self) -> Self;
fn sin(self) -> Self;
fn cos(self) -> Self;
fn atan2(self, x: Self) -> Self;
fn round(self) -> Self;
fn powi(self, n: i32) -> Self;
fn abs(self) -> Self;
fn rem_euclid(self, rhs: Self) -> Self;
fn clamp(self, min: Self, max: Self) -> Self;
fn max(self, other: Self) -> Self;
fn min(self, other: Self) -> Self;
}Expand description
Floating-point scalar operations for color math.
Implemented for f32 and f64. When f16 stabilizes in Rust it will
implement this trait and all operations will work at half precision without
further changes. Transcendental functions are provided by the standard
library under the std feature and by libm under no_std.
Required Associated Constants§
Sourceconst MIN_POSITIVE: Self
const MIN_POSITIVE: Self
Smallest positive value.
Required Methods§
Sourcefn from_f64(v: f64) -> Self
fn from_f64(v: f64) -> Self
Convert an f64 literal to Self. Used to widen f32 constants in
generic code; for f32 this narrows back from f64, which is lossless
for all constants in this crate.
Sourcefn rem_euclid(self, rhs: Self) -> Self
fn rem_euclid(self, rhs: Self) -> Self
Euclidean remainder.
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.