Skip to main content

BesselFloat

Trait BesselFloat 

Source
pub trait BesselFloat:
    Float
    + Debug
    + 'static {
    const MACH_EPSILON: Self;
    const MACH_TINY: Self;
    const MACH_HUGE: Self;
    const MACH_DIGITS: i32;
    const MACH_MIN_EXP: i32;
    const MACH_MAX_EXP: i32;

    // Required methods
    fn from_f64(x: f64) -> Self;
    fn tol() -> Self;
    fn fnul() -> Self;
    fn rl() -> Self;
    fn elim() -> Self;
    fn alim() -> Self;
    fn fma(self, a: Self, b: Self) -> Self;
}
Expand description

Floating-point trait for Bessel and Airy function computation.

Implemented for f64 and f32. Provides machine constants and derived thresholds used by the Amos algorithm.

Required Associated Constants§

Source

const MACH_EPSILON: Self

Machine epsilon (D1MACH(3)).

Source

const MACH_TINY: Self

Smallest positive normal number (D1MACH(1)).

Source

const MACH_HUGE: Self

Largest representable number (D1MACH(2)).

Source

const MACH_DIGITS: i32

Number of binary digits in the mantissa (I1MACH(14)).

Source

const MACH_MIN_EXP: i32

Minimum binary exponent (I1MACH(12)).

Source

const MACH_MAX_EXP: i32

Maximum binary exponent (I1MACH(11)).

Required Methods§

Source

fn from_f64(x: f64) -> Self

Infallible conversion from f64.

For f64 this is the identity; for f32 it truncates via as f32. All Amos algorithm constants originate as f64 literals, so this conversion always succeeds for the supported types.

Source

fn tol() -> Self

Tolerance: max(MACH_EPSILON, 1e-18).

Source

fn fnul() -> Self

Large order threshold: 10 + 6*(DIG - 3), where DIG = log10(2) * (DIGITS - 1).

Source

fn rl() -> Self

Asymptotic region boundary: 1.2*DIG + 3, where DIG = log10(2) * (DIGITS - 1).

Source

fn elim() -> Self

Underflow elimination threshold: 2.303*(K*R1M5 - 3), K = min(|MIN_EXP|, MAX_EXP).

Source

fn alim() -> Self

Overflow elimination threshold: ELIM + max(-2.303R1M5(DIGITS-1), -41.45).

Source

fn fma(self, a: Self, b: Self) -> Self

Fused multiply-add: self * a + b.

With std enabled, uses hardware FMA via the C library fma(). Without std, falls back to plain self * a + b to avoid the slow software FMA in libm.

Named fma to avoid ambiguity with Float::mul_add.

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.

Implementations on Foreign Types§

Source§

impl BesselFloat for f32

Source§

const MACH_EPSILON: f32 = 1.1920929e-7

Source§

const MACH_TINY: f32 = 1.1754944e-38

Source§

const MACH_HUGE: f32 = 3.4028235e+38

Source§

const MACH_DIGITS: i32 = 24

Source§

const MACH_MIN_EXP: i32 = -125

Source§

const MACH_MAX_EXP: i32 = 128

Source§

fn from_f64(x: f64) -> f32

Source§

fn tol() -> f32

Source§

fn fnul() -> f32

Source§

fn rl() -> f32

Source§

fn elim() -> f32

Source§

fn alim() -> f32

Source§

fn fma(self, a: f32, b: f32) -> f32

Source§

impl BesselFloat for f64

Source§

const MACH_EPSILON: f64 = 2.220446049250313e-16

Source§

const MACH_TINY: f64 = 2.2250738585072014e-308

Source§

const MACH_HUGE: f64 = 1.7976931348623157e+308

Source§

const MACH_DIGITS: i32 = 53

Source§

const MACH_MIN_EXP: i32 = -1021

Source§

const MACH_MAX_EXP: i32 = 1024

Source§

fn from_f64(x: f64) -> f64

Source§

fn tol() -> f64

Source§

fn fnul() -> f64

Source§

fn rl() -> f64

Source§

fn elim() -> f64

Source§

fn alim() -> f64

Source§

fn fma(self, a: f64, b: f64) -> f64

Implementors§