Skip to main content

FloatElement

Trait FloatElement 

Source
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§

Source

fn from_f32(val: f32) -> Self

Convert from f32.

Source

fn from_f64(val: f64) -> Self

Convert from f64.

Source

fn to_f32(self) -> f32

Cast to f32.

Provided Methods§

Source

fn exp(self) -> Self

e^self.

Source

fn ln(self) -> Self

Natural logarithm.

Source

fn sin(self) -> Self

Sine (radians).

Source

fn cos(self) -> Self

Cosine (radians).

Source

fn acos(self) -> Self

Inverse cosine (radians).

Source

fn tan(self) -> Self

Tangent (radians).

Source

fn sinh(self) -> Self

Hyperbolic sine.

Source

fn cosh(self) -> Self

Hyperbolic cosine.

Source

fn tanh(self) -> Self

Hyperbolic tangent.

Source

fn atan2(self, other: Self) -> Self

Four-quadrant arctangent of self / other.

Source

fn powf(self, n: Self) -> Self

self raised to the power n.

Source

fn recip(self) -> Self

Reciprocal 1 / self.

Source

fn floor(self) -> Self

Largest integer ≤ self.

Source

fn ceil(self) -> Self

Smallest integer ≥ self.

Source

fn round(self) -> Self

Nearest integer, half away from zero.

Source

fn trunc(self) -> Self

Integer part (toward zero).

Source

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).

Source

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.

Source

fn log10(self) -> Self

Base-10 logarithm, log₁₀(self).

Default routes through f32 via libm; f64 overrides with the native double-precision path.

Source

fn log2(self) -> Self

Base-2 logarithm, log₂(self).

Default routes through f32 via libm; f64 overrides with the native double-precision path.

Source

fn erf(self) -> Self

Error function erf(self) = 2/√π ∫₀ˢᵉˡᶠ e^(-t²) dt.

Default routes through f32; native-precision types override.

Source

fn erfc(self) -> Self

Complementary error function erfc(self) = 1 - erf(self), computed without the cancellation error of 1 - erf for large self.

Source

fn lgamma(self) -> Self

Natural logarithm of the absolute value of the gamma function, ln|Γ(self)|.

Source

fn default_epsilon() -> Self
where 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.

Source

fn pi() -> Self
where Self: RealField,

Returns π as this float type (nalgebra compatibility alias for RealField::PI).

Source

fn max(self, other: Self) -> Self

Componentwise maximum (method form; prefer NumericElement::max_scalar in new code).

Source

fn min(self, other: Self) -> Self

Componentwise minimum (method form; prefer NumericElement::min_scalar in new code).

Source

fn norm(self) -> Self

L2 (Euclidean) norm — for scalars this is the absolute value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FloatElement for f32

Source§

fn from_f32(val: f32) -> f32

Source§

fn from_f64(val: f64) -> f32

Source§

fn to_f32(self) -> f32

Source§

impl FloatElement for f64

Source§

fn from_f32(val: f32) -> f64

Source§

fn from_f64(val: f64) -> f64

Source§

fn to_f32(self) -> f32

Source§

fn exp(self) -> f64

Source§

fn ln(self) -> f64

Source§

fn sin(self) -> f64

Source§

fn cos(self) -> f64

Source§

fn acos(self) -> f64

Source§

fn tan(self) -> f64

Source§

fn sinh(self) -> f64

Source§

fn cosh(self) -> f64

Source§

fn tanh(self) -> f64

Source§

fn atan2(self, other: f64) -> f64

Source§

fn powf(self, n: f64) -> f64

Source§

fn recip(self) -> f64

Source§

fn floor(self) -> f64

Source§

fn ceil(self) -> f64

Source§

fn round(self) -> f64

Source§

fn trunc(self) -> f64

Source§

fn signum(self) -> f64

Source§

fn log10(self) -> f64

Source§

fn log2(self) -> f64

Source§

fn erf(self) -> f64

Source§

fn erfc(self) -> f64

Source§

fn lgamma(self) -> f64

Implementors§