std-method

Floating-point classify

Classify a sample into one of five categories before applying domain-specific rules. Expected stdout (not executed): Zero Subnormal Normal Infinite Nan Common mistake: Subnormal does not mean invalid or NaN.

Formal Syntax & Structure

rust syntaxrust
x.classify() -> FpCategory

Working Example

Example Snippetrust
fn main() {    for x in [0.0_f64, f64::from_bits(1), 2.0, f64::INFINITY, f64::NAN] { println!("{:?}", x.classify());    }}
Rust Reference