Browse Source

Merge pull request #314 from rogpeppe/021-64-bit-floats

use 64 bit precision when formatting float values
Roger Peppe 8 years ago
parent
commit
031c922227
1 changed files with 1 additions and 2 deletions
  1. 1 2
      encode.go

+ 1 - 2
encode.go

@@ -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"