1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:44:41 -07:00

xml: differentiate between float32 and float64 for marshalSimple

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7235045
This commit is contained in:
Vega Garcia Luis Alfonso 2013-01-28 12:54:27 -05:00 committed by Russ Cox
parent 09ea3b518e
commit cf1f542420

View File

@ -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()))