aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/float.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2018-10-29 10:24:05 -0700
committerRobert Griesemer <gri@golang.org>2018-10-29 18:23:31 +0000
commitc86d4647348b420f55d4ce7572c4cd93b20a1d4a (patch)
treeada8931ce5d603e33c439b47871a7d4dd4e46892 /src/math/big/float.go
parent9ce87a63b9f440b452ada1ff89ccb1c4f3ca919f (diff)
downloadgo-c86d4647348b420f55d4ce7572c4cd93b20a1d4a.tar.xz
math/big: shallow copies of Int/Rat/Float are not supported (documentation)
Fixes #28423. Change-Id: Ie57ade565d0407a4bffaa86fb4475ff083168e79 Reviewed-on: https://go-review.googlesource.com/c/145537 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/math/big/float.go')
-rw-r--r--src/math/big/float.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/math/big/float.go b/src/math/big/float.go
index 6b0cb3f1ed..d5e801b2c8 100644
--- a/src/math/big/float.go
+++ b/src/math/big/float.go
@@ -43,7 +43,7 @@ const debugFloat = false // enable for debugging
// precision of the argument with the largest precision value before any
// rounding takes place, and the rounding mode remains unchanged. Thus,
// uninitialized Floats provided as result arguments will have their
-// precision set to a reasonable value determined by the operands and
+// precision set to a reasonable value determined by the operands, and
// their mode is the zero value for RoundingMode (ToNearestEven).
//
// By setting the desired precision to 24 or 53 and using matching rounding
@@ -56,6 +56,12 @@ const debugFloat = false // enable for debugging
// The zero (uninitialized) value for a Float is ready to use and represents
// the number +0.0 exactly, with precision 0 and rounding mode ToNearestEven.
//
+// Operations always take pointer arguments (*Float) rather
+// than Float values, and each unique Float value requires
+// its own unique *Float pointer. To "copy" a Float value,
+// an existing (or newly allocated) Float must be set to
+// a new value using the Float.Set method; shallow copies
+// of Floats are not supported and may lead to errors.
type Float struct {
prec uint32
mode RoundingMode