Skip to main content

str_to_double

Function str_to_double 

Source
pub fn str_to_double(bytes: &[u8]) -> Option<f64>
Expand description

Parse a cleaned decimal/real numeric buffer (only [0-9.eE+-], separators already stripped) to an f64. Returns the value if the WHOLE buffer parses, or None on invalid input — mirroring fastStrToDouble’s “consume all or fail” contract. Out-of-range inputs parse to +/-inf or 0.0 (as fast_float and Rust std both do). Rust std’s parser is the same correctly-rounded algorithm as the lexer’s fast_float, so results are bit-identical.