Skip to content

Commit

Permalink
Merge pull request #6 from dtolnay/negativenan
Browse files Browse the repository at this point in the history
Handle the possibility of f64::NAN being a negative NaN
  • Loading branch information
dtolnay authored Oct 26, 2023
2 parents 6f6fd9b + 565f82a commit 62c01ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,13 +1121,13 @@ impl<'a> Deserializer<'a> {
})
} else if s == "nan" {
Ok(Value {
e: E::Float(f64::NAN),
e: E::Float(f64::NAN.copysign(1.0)),
start,
end,
})
} else if s == "-nan" {
Ok(Value {
e: E::Float(-f64::NAN),
e: E::Float(f64::NAN.copysign(-1.0)),
start,
end,
})
Expand Down

0 comments on commit 62c01ca

Please sign in to comment.