Skip to content

Commit

Permalink
Use the brand new float writer to write floats32 if lossless.
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Sep 30, 2024
1 parent eaf6fc4 commit 2762177
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion msgp/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ func (mw *Writer) WriteJSONNumber(n json.Number) error {
}
ff, err := n.Float64()
if err == nil {
return mw.WriteFloat64(ff)
return mw.WriteFloat(ff)
}
return err
}
Expand Down
2 changes: 1 addition & 1 deletion msgp/write_bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func AppendJSONNumber(b []byte, n json.Number) ([]byte, error) {
}
ff, err := n.Float64()
if err == nil {
return AppendFloat64(b, ff), nil
return AppendFloat(b, ff), nil
}
return b, err
}

0 comments on commit 2762177

Please sign in to comment.