Skip to content

Commit

Permalink
fix(stdlib): improved float accuracy with float_roundtrip serde_json …
Browse files Browse the repository at this point in the history
…feature vectordotdev#755
  • Loading branch information
drmason13 committed Mar 26, 2024
1 parent 20575cb commit 1d0e780
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ rustyline = { version = "14", default-features = false, optional = true }
rust_decimal = { version = "1", optional = true }
seahash = { version = "4", optional = true }
serde = { version = "1", features = ["derive"], optional = true }
serde_json = { version = "1", default-features = false, optional = true, features = ["std", "raw_value"] }
serde_json = { version = "1", default-features = false, optional = true, features = ["std", "raw_value", "float_roundtrip"] }
sha-1 = { version = "0.10", optional = true }
sha-2 = { package = "sha2", version = "0.10", optional = true }
sha-3 = { package = "sha3", version = "0.10", optional = true }
Expand Down
6 changes: 6 additions & 0 deletions src/stdlib/parse_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,11 @@ mod tests {
want: Ok(value!({"num": 9.223_372_036_854_776e18})),
tdef: type_def(),
}

lossless_float_conversion {
args: func_args![ value: r#"{"num": 1626175065.5934923}"#],
want: Ok(value!({"num": 1_626_175_065.593_492_3})),
tdef: type_def(),
}
];
}

0 comments on commit 1d0e780

Please sign in to comment.