fn permissive_f64_parse(a: &str) -> f64 {
    // Maybe should be split on non-digit, but then 10e100 won't parse properly.
    // On the flip side, this will give NEG_INFINITY for "1,234", which might be OK
    // because there's no way to handle both CSV and thousands separators without a new flag.
    // GNU sort treats "1,234" as "1" in numeric, so maybe it's fine.
    // GNU sort treats "NaN" as non-number in numeric, so it needs special care.
    match a.split_whitespace().next() {
        None => std::f64::NEG_INFINITY,
        Some(sa) => match sa.parse::<f64>() {
            Ok(a) if a.is_nan() => std::f64::NEG_INFINITY,
            Ok(a) => a,
            Err(_) => std::f64::NEG_INFINITY,
        },
    }
}
/// Parse the beginning string into an f64, returning -inf instead of NaN on errors.
Parse the beginning string into an f64, returning -inf instead of NaN on errors.
Parse the beginning string into an f64 returning - inf instead of NaN on errors .
fn permissive_f64_parse(a: &str) -> f64 {
    // Maybe should be split on non-digit, but then 10e100 won't parse properly.
    // On the flip side, this will give NEG_INFINITY for "1,234", which might be OK
    // because there's no way to handle both CSV and thousands separators without a new flag.
    // GNU sort treats "1,234" as "1" in numeric, so maybe it's fine.
    // GNU sort treats "NaN" as non-number in numeric, so it needs special care.
    match a.split_whitespace().next() {
        None => std::f64::NEG_INFINITY,
        Some(sa) => match sa.parse::<f64>() {
            Ok(a) if a.is_nan() => std::f64::NEG_INFINITY,
            Ok(a) => a,
            Err(_) => std::f64::NEG_INFINITY,
        },
    }
}
fn permissive_f64_parse ( a : & str ) -> f64 { // Maybe should be split on non-digit, but then 10e100 won't parse properly. // On the flip side, this will give NEG_INFINITY for "1,234", which might be OK // because there's no way to handle both CSV and thousands separators without a new flag. // GNU sort treats "1,234" as "1" in numeric, so maybe it's fine. // GNU sort treats "NaN" as non-number in numeric, so it needs special care. match a . split_whitespace ( ) . next ( ) { None => std :: f64 :: NEG_INFINITY , Some ( sa ) => match sa . parse :: < f64 > ( ) { Ok ( a ) if a . is_nan ( ) => std :: f64 :: NEG_INFINITY , Ok ( a ) => a , Err ( _ ) => std :: f64 :: NEG_INFINITY , } , } }
Parse the beginning string into an f64, returning -inf instead of NaN on errors.
Parse the beginning string into an f64 returning - inf instead of NaN on errors .
a
&str
a
&str