pub trait FloatExt {
// Required methods
fn ln(self) -> Self;
fn sqrt(self) -> Self;
fn cos(self) -> Self;
fn exp(self) -> Self;
}Expand description
Floating-point math operations bridged across std / libm.
This trait provides a unified interface for mathematical functions that
are usually available in the standard library but missing in core.
§Examples
use vrd::FloatExt;
let n = 2.0f64;
let ln_n = n.ln();
let sqrt_n = n.sqrt();Required Methods§
Sourcefn ln(self) -> Self
fn ln(self) -> Self
Natural logarithm.
§Examples
use vrd::FloatExt;
let n: f64 = std::f64::consts::E;
assert!((FloatExt::ln(n) - 1.0).abs() < 1e-12);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.