Skip to content

Commit

Permalink
Merge pull request #314 from rogpeppe/021-64-bit-floats
Browse files Browse the repository at this point in the history
use 64 bit precision when formatting float values
  • Loading branch information
rogpeppe authored Jan 9, 2018
2 parents cdd36ee + b7fbda9 commit 031c922
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ func (e *encoder) timev(tag string, in reflect.Value) {
}

func (e *encoder) floatv(tag string, in reflect.Value) {
// FIXME: Handle 64 bits here.
s := strconv.FormatFloat(float64(in.Float()), 'g', -1, 32)
s := strconv.FormatFloat(in.Float(), 'g', -1, 64)
switch s {
case "+Inf":
s = ".inf"
Expand Down

0 comments on commit 031c922

Please sign in to comment.