From cf1f542420415826040be93bc2a252ec605a1196 Mon Sep 17 00:00:00 2001 From: Vega Garcia Luis Alfonso Date: Mon, 28 Jan 2013 12:54:27 -0500 Subject: [PATCH] xml: differentiate between float32 and float64 for marshalSimple R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7235045 --- src/pkg/encoding/xml/marshal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg/encoding/xml/marshal.go b/src/pkg/encoding/xml/marshal.go index 383fb26b04..aacb50c9cf 100644 --- a/src/pkg/encoding/xml/marshal.go +++ b/src/pkg/encoding/xml/marshal.go @@ -241,7 +241,7 @@ func (p *printer) marshalSimple(typ reflect.Type, val reflect.Value) error { case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: p.WriteString(strconv.FormatUint(val.Uint(), 10)) case reflect.Float32, reflect.Float64: - p.WriteString(strconv.FormatFloat(val.Float(), 'g', -1, 64)) + p.WriteString(strconv.FormatFloat(val.Float(), 'g', -1, val.Type().Bits())) case reflect.String: // TODO: Add EscapeString. Escape(p, []byte(val.String())) -- 2.48.1