Skip to content

Commit

Permalink
fix: Deterministically parse nan as a positive NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 26, 2023
1 parent 151f2e2 commit 90253a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/toml_edit/src/parser/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ pub(crate) fn inf(input: &mut Input<'_>) -> PResult<f64> {
const INF: &[u8] = b"inf";
// nan = %x6e.61.6e ; nan
pub(crate) fn nan(input: &mut Input<'_>) -> PResult<f64> {
tag(NAN).value(f64::NAN).parse_next(input)
tag(NAN).value(f64::NAN.copysign(1.0)).parse_next(input)
}
const NAN: &[u8] = b"nan";

Expand Down

0 comments on commit 90253a6

Please sign in to comment.