This commit is contained in:
Yuriy Dupyn 2024-01-28 22:08:46 +01:00
parent 8eec9c6759
commit 2ba158a0d4
7 changed files with 41 additions and 18 deletions

View file

@ -28,9 +28,10 @@ pub fn parse_number(input: &str) -> IResult<&str, Value> {
Some((_fsign, fdigits)) => {
// Combine integer and fractional parts
let combined_parts = format!(
"{}{}",
format!("{}{}", sign.unwrap_or('+'), digits),
format!(".{}", fdigits)
"{}{}.{}",
sign.unwrap_or('+'),
digits,
fdigits
);
// Parse the combined parts as a floating-point number
let value = combined_parts.parse::<f64>()