Commit d15597e1 authored by Dave Cheney's avatar Dave Cheney Committed by Robert Griesemer

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/10604Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
parent 0f6da892
......@@ -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, '+')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment