pub trait FloatElement: Sealed + NumericElement {
Show 31 methods
// Required methods
fn from_f32(val: f32) -> Self;
fn from_f64(val: f64) -> Self;
fn to_f32(self) -> f32;
// Provided methods
fn exp(self) -> Self { ... }
fn ln(self) -> Self { ... }
fn sin(self) -> Self { ... }
fn cos(self) -> Self { ... }
fn acos(self) -> Self { ... }
fn tan(self) -> Self { ... }
fn sinh(self) -> Self { ... }
fn cosh(self) -> Self { ... }
fn tanh(self) -> Self { ... }
fn atan2(self, other: Self) -> Self { ... }
fn powf(self, n: Self) -> Self { ... }
fn recip(self) -> Self { ... }
fn floor(self) -> Self { ... }
fn ceil(self) -> Self { ... }
fn round(self) -> Self { ... }
fn trunc(self) -> Self { ... }
fn signum(self) -> Self { ... }
fn powi(self, n: i32) -> Self { ... }
fn log10(self) -> Self { ... }
fn log2(self) -> Self { ... }
fn erf(self) -> Self { ... }
fn erfc(self) -> Self { ... }
fn lgamma(self) -> Self { ... }
fn default_epsilon() -> Self
where Self: RealField { ... }
fn pi() -> Self
where Self: RealField { ... }
fn max(self, other: Self) -> Self { ... }
fn min(self, other: Self) -> Self { ... }
fn norm(self) -> Self { ... }
}Expand description
Float-specific capabilities.
Required Methods§
Provided Methods§
Sourcefn signum(self) -> Self
fn signum(self) -> Self
Sign of self: 1 for positive/+0, -1 for negative/-0, NaN for
NaN (matching f64::signum / num_traits::Float::signum).
Sourcefn powi(self, n: i32) -> Self
fn powi(self, n: i32) -> Self
self raised to an integer power via exponentiation by squaring.
Exact for integer exponents and correct for negative bases (unlike
powf). A default over the NumericElement arithmetic —
no per-type implementation needed, so no precision is lost.
Sourcefn log10(self) -> Self
fn log10(self) -> Self
Base-10 logarithm, log₁₀(self).
Default routes through f32 via libm; f64 overrides with the
native double-precision path.
Sourcefn log2(self) -> Self
fn log2(self) -> Self
Base-2 logarithm, log₂(self).
Default routes through f32 via libm; f64 overrides with the
native double-precision path.
Sourcefn erf(self) -> Self
fn erf(self) -> Self
Error function erf(self) = 2/√π ∫₀ˢᵉˡᶠ e^(-t²) dt.
Default routes through f32; native-precision types override.
Sourcefn erfc(self) -> Self
fn erfc(self) -> Self
Complementary error function erfc(self) = 1 - erf(self), computed without
the cancellation error of 1 - erf for large self.
Sourcefn lgamma(self) -> Self
fn lgamma(self) -> Self
Natural logarithm of the absolute value of the gamma function, ln|Γ(self)|.
Sourcefn default_epsilon() -> Selfwhere
Self: RealField,
fn default_epsilon() -> Selfwhere
Self: RealField,
Machine epsilon (nalgebra::RealField::default_epsilon compatibility alias).
Returns the smallest positive value ε such that 1.0 + ε != 1.0.
Prefer <T as eunomia::RealField>::EPSILON in new code.
Sourcefn pi() -> Selfwhere
Self: RealField,
fn pi() -> Selfwhere
Self: RealField,
Returns π as this float type (nalgebra compatibility alias for RealField::PI).
Sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Componentwise maximum (method form; prefer NumericElement::max_scalar in new code).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".