Function double

fn double<T, E: ParseError<T>>(input: T) -> IResult<T, f64, E>
where
    T: Clone + Offset + ParseTo<f64> + Compare<&'static str> + Input + AsBytes + for<'a> Compare<&'a [u8]>,
    <T as Input>::Item: AsChar,
    <T as Input>::Iter: Clone

Recognizes floating point number in text format and returns a f64.

Complete version: Can parse until the end of input.

# use nom::{Err, error::ErrorKind, Needed};
# use nom::Needed::Size;
use nom::number::complete::double;

let parser = |s| {
  double(s)
};

assert_eq!(parser("11e-1"), Ok(("", 1.1)));
assert_eq!(parser("123E-02"), Ok(("", 1.23)));
assert_eq!(parser("123K-01"), Ok(("K-01", 123.0)));
assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Float))));