]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: document that Rat.Denom might modify the receiver
authorEric Lagergren <eric@ericlagergren.com>
Wed, 28 Aug 2019 02:32:17 +0000 (19:32 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 28 Aug 2019 16:20:00 +0000 (16:20 +0000)
Fixes #33792

Change-Id: I306a95883c3db2d674d3294a6feb50adc50ee5d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/192017
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/big/rat.go

index c8bf698b184970a82a934e7566385be759865f3d..712116a08cdc8a4f9802de52d313fa0c78771574 100644 (file)
@@ -413,6 +413,8 @@ func (x *Rat) Num() *Int {
 // Denom returns the denominator of x; it is always > 0.
 // The result is a reference to x's denominator; it
 // may change if a new value is assigned to x, and vice versa.
+// If x's denominator is 1, Denom may materialize the denominator, thereby
+// modifying x.
 func (x *Rat) Denom() *Int {
        x.b.neg = false // the result is always >= 0
        if len(x.b.abs) == 0 {