From: Vega Garcia Luis Alfonso Date: Mon, 28 Jan 2013 17:54:27 +0000 (-0500) Subject: xml: differentiate between float32 and float64 for marshalSimple X-Git-Tag: go1.1rc2~1277 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cf1f542420415826040be93bc2a252ec605a1196;p=gostls13.git xml: differentiate between float32 and float64 for marshalSimple R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7235045 --- 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()))