pub trait Float:
Sealed
+ Copy
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self> {
const IS_F64: bool;
// Required methods
fn from_f32(v: f32) -> Self;
fn from_f64(v: f64) -> Self;
fn to_f32(self) -> f32;
fn to_f64(self) -> f64;
fn exp(self) -> Self;
fn log10(self) -> Self;
fn powf(self, exp: Self) -> Self;
}Expand description
Math on f32 or f64 (gains, freqs, coefficients — not necessarily samples).
Prefer Sample for AudioBuffer<S> and similar buffer bounds.
Required Associated Constants§
Required Methods§
Sourcefn from_f64(v: f64) -> Self
fn from_f64(v: f64) -> Self
Narrow f64 → this precision. Debug-asserts non-NaN on f32
(NaN in the audio path is always a bug). Release keeps NaN via as.
Sourcefn to_f32(self) -> f32
fn to_f32(self) -> f32
Narrow to f32 (same NaN debug-assert as Self::from_f64).
fn exp(self) -> Self
fn log10(self) -> Self
fn powf(self, exp: Self) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".