std-method

Floating-point is_normal and is_subnormal

Detect tiny representable nonzero values that fall below the normal positive range. Expected stdout (not executed): false true true Common mistake: MIN_POSITIVE is the smallest positive normal value, not the smallest nonzero value.

Formal Syntax & Structure

rust syntaxrust
x.is_normal() -> bool; x.is_subnormal() -> bool

Working Example

Example Snippetrust
fn main() {    let tiny = f64::from_bits(1);    println!("{} {}", tiny.is_normal(), tiny.is_subnormal());    println!("{}", f64::MIN_POSITIVE.is_normal());}
Rust Reference