From: Dave Cheney Date: Tue, 2 Jun 2015 03:08:59 +0000 (+1000) Subject: math/big: trim trailing zeros before hex printing X-Git-Tag: go1.5beta1~379 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d15597e1b21a0324692e8664eb6b2f8158dafd10;p=gostls13.git math/big: trim trailing zeros before hex printing m was being resliced as the result of looking for the first non zero word of the mantissa, however m was not used later in printing. Spotted by Gordon Klaus, https://groups.google.com/forum/#!topic/golang-nuts/MdDLbvOjb4o Change-Id: Ifbebb51ea5e0d86cb8e0422eb184b8634639a733 Reviewed-on: https://go-review.googlesource.com/10604 Reviewed-by: Robert Griesemer --- diff --git a/src/math/big/ftoa.go b/src/math/big/ftoa.go index 13bb26f0d2..5c5f2cea46 100644 --- a/src/math/big/ftoa.go +++ b/src/math/big/ftoa.go @@ -289,7 +289,7 @@ func (x *Float) fmtP(buf []byte) []byte { m = m[i:] buf = append(buf, "0x."...) - buf = append(buf, strings.TrimRight(x.mant.hexString(), "0")...) + buf = append(buf, strings.TrimRight(m.hexString(), "0")...) buf = append(buf, 'p') if x.exp >= 0 { buf = append(buf, '+')