Skip to content

Commit

Permalink
Parse -0 as float -0.0 instead of integer 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Sep 14, 2021
1 parent f5219be commit 51a4db1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/de.rs
Expand Up @@ -434,8 +434,8 @@ impl<'de, R: Read<'de>> Deserializer<R> {
} else {
let neg = (significand as i64).wrapping_neg();

// Convert into a float if we underflow.
if neg > 0 {
// Convert into a float if we underflow, or on `-0`.
if neg >= 0 {
ParserNumber::F64(-(significand as f64))
} else {
ParserNumber::I64(neg)
Expand Down

0 comments on commit 51a4db1

Please sign in to comment.