فهرست منبع

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

use 64 bit precision when formatting float values
Roger Peppe 8 سال پیش
والد
کامیت
031c922227
1فایلهای تغییر یافته به همراه1 افزوده شده و 2 حذف شده
  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) {
 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 {
 	switch s {
 	case "+Inf":
 	case "+Inf":
 		s = ".inf"
 		s = ".inf"