Skip to main content

MachineConstants

Trait MachineConstants 

Source
pub trait MachineConstants: Float + Debug {
    // Required methods
    fn machine_epsilon() -> Self;
    fn min_positive_normal() -> Self;
    fn max_finite() -> Self;
    fn min_positive_subnormal() -> Self;
    fn mantissa_digits() -> u32;

    // Provided method
    fn radix() -> u32 { ... }
}
Expand description

Machine-specific constants for a floating-point type.

Provides type-level access to epsilon, minimum/maximum normal values, minimum positive subnormal, and radix information.

Required Methods§

Source

fn machine_epsilon() -> Self

Machine epsilon (difference between 1.0 and the next representable value).

Source

fn min_positive_normal() -> Self

Smallest positive normal number.

Source

fn max_finite() -> Self

Largest finite number.

Source

fn min_positive_subnormal() -> Self

Smallest positive subnormal number (closest to zero without being zero).

Source

fn mantissa_digits() -> u32

Number of significand (mantissa) bits.

Provided Methods§

Source

fn radix() -> u32

Radix of the floating-point representation (always 2 for IEEE 754).

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 MachineConstants for f32

Source§

impl MachineConstants for f64

Implementors§