mirror of
https://github.com/golang/go
synced 2024-11-18 07:04:52 -07:00
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 <gri@golang.org>
This commit is contained in:
parent
0f6da8923f
commit
d15597e1b2
@ -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, '+')
|
||||
|
Loading…
Reference in New Issue
Block a user