Browse Source

codec: json: remove redundant float64 conversion

Ugorji Nwoke 9 năm trước cách đây
mục cha
commit
13b86143eb
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      codec/json.go

+ 1 - 1
codec/json.go

@@ -206,7 +206,7 @@ func (e *jsonEncDriver) EncodeFloat64(f float64) {
 }
 }
 
 
 func (e *jsonEncDriver) encodeFloat(f float64, numbits int) {
 func (e *jsonEncDriver) encodeFloat(f float64, numbits int) {
-	x := strconv.AppendFloat(e.b[:0], float64(f), 'G', -1, numbits)
+	x := strconv.AppendFloat(e.b[:0], f, 'G', -1, numbits)
 	e.w.writeb(x)
 	e.w.writeb(x)
 	if bytes.IndexByte(x, 'E') == -1 && bytes.IndexByte(x, '.') == -1 {
 	if bytes.IndexByte(x, 'E') == -1 && bytes.IndexByte(x, '.') == -1 {
 		e.w.writen2('.', '0')
 		e.w.writen2('.', '0')