aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/float.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2015-05-22 13:58:03 -0700
committerRobert Griesemer <gri@golang.org>2015-05-22 23:12:51 +0000
commit2df1ccdbc6aac9e570e985437d741d723cb3497c (patch)
treed502df4099b123bcfbdfef51a11d4fe774dae984 /src/math/big/float.go
parent22e4b8167f14bdd33738cfdc21c3396b2341f8fd (diff)
downloadgo-2df1ccdbc6aac9e570e985437d741d723cb3497c.tar.xz
math/big: Always print exponent sign when using 'p' exponent for Floats.
Float.Format supports the 'b' and 'p' format, both of which print a binary ('p') exponent. The 'b' format always printed a sign ('+' or '-') for the exponent; the 'p' format only printed a negative sign for the exponent. This change makes the two consistent. It also makes the 'p' format easier to read if the exponent is >= 0. Also: - Comments added elsewhere. Change-Id: Ifd2e01bdafb3043345972ca22a90248d055bd29b Reviewed-on: https://go-review.googlesource.com/10359 Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/math/big/float.go')
-rw-r--r--src/math/big/float.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/math/big/float.go b/src/math/big/float.go
index dcb72c5754..e663c1c6ac 100644
--- a/src/math/big/float.go
+++ b/src/math/big/float.go
@@ -913,6 +913,7 @@ func (x *Float) Float32() (float32, Accuracy) {
}
return float32(math.Inf(+1)), Above
}
+ // e <= emax
// Determine sign, biased exponent, and mantissa.
var sign, bexp, mant uint32
@@ -1019,6 +1020,7 @@ func (x *Float) Float64() (float64, Accuracy) {
}
return math.Inf(+1), Above
}
+ // e <= emax
// Determine sign, biased exponent, and mantissa.
var sign, bexp, mant uint64