(literal: &[u8])
| 14 | } |
| 15 | |
| 16 | fn parse_inner(literal: &[u8]) -> Option<f64> { |
| 17 | use lexical_parse_float::{ |
| 18 | FromLexicalWithOptions, NumberFormatBuilder, Options, format::PYTHON3_LITERAL, |
| 19 | }; |
| 20 | |
| 21 | // lexical-core's format::PYTHON_STRING is inaccurate |
| 22 | const PYTHON_STRING: u128 = NumberFormatBuilder::rebuild(PYTHON3_LITERAL) |
| 23 | .no_special(false) |
| 24 | .build_unchecked(); |
| 25 | f64::from_lexical_with_options::<PYTHON_STRING>(literal, &Options::new()).ok() |
| 26 | } |
| 27 | |
| 28 | pub fn is_integer(v: f64) -> bool { |
| 29 | v.is_finite() && v.fract() == 0.0 |
no test coverage detected