From 31e852402fdf36ccc9fd84436d082e960b755cd3 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 13 Feb 2015 12:47:44 -0800 Subject: math/big: fix aliasing error in Add, Sub Also: - make representation more flexible (no need to store trailing 0 digits to match precision) - simplify rounding as a consequence - minor related fixes TBR adonovan Change-Id: Ie91075990688b506d28371ec3b633b8267397ebb Reviewed-on: https://go-review.googlesource.com/4841 Reviewed-by: Rob Pike --- src/math/big/floatconv.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/math/big/floatconv.go') diff --git a/src/math/big/floatconv.go b/src/math/big/floatconv.go index 71920cd51c..511cc51889 100644 --- a/src/math/big/floatconv.go +++ b/src/math/big/floatconv.go @@ -215,9 +215,9 @@ func (x *Float) Append(buf []byte, format byte, prec int) []byte { return x.bigFtoa(buf, format, prec) } -// BUG(gri): Currently, String uses the 'p' (rather than 'g') format. +// BUG(gri): Currently, String uses x.Format('g', 10) rather than x.Format('g', -1). func (x *Float) String() string { - return x.Format('p', 0) + return x.Format('g', 10) } // bstring appends the string of x in the format ["-"] mantissa "p" exponent -- cgit v1.3-5-g9baa