Skip to content

Commit

Permalink
Format flats with Debug to properly print "-0.0".
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt committed May 1, 2015
1 parent c3fe6c9 commit f0c87fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/json/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ fn fmt_f32_or_null<W>(wr: &mut W, value: f32) -> io::Result<()>
match value.classify() {
FpCategory::Nan | FpCategory::Infinite => wr.write_all(b"null"),
_ => {
let s = value.to_string();
let s = format!("{:?}", value);
try!(wr.write_all(s.as_bytes()));
if !s.contains('.') {
try!(wr.write_all(b".0"))
Expand All @@ -434,7 +434,7 @@ fn fmt_f64_or_null<W>(wr: &mut W, value: f64) -> io::Result<()>
match value.classify() {
FpCategory::Nan | FpCategory::Infinite => wr.write_all(b"null"),
_ => {
let s = value.to_string();
let s = format!("{:?}", value);
try!(wr.write_all(s.as_bytes()));
if !s.contains('.') {
try!(wr.write_all(b".0"))
Expand Down

0 comments on commit f0c87fb

Please sign in to comment.