Skip to content

Commit b08568d

Browse files
ericlagergrentomocy
authored andcommitted
math/big: document that Rat.Denom might modify the receiver
Fixes golang#33792 Change-Id: I306a95883c3db2d674d3294a6feb50adc50ee5d6 Reviewed-on: https://go-review.googlesource.com/c/go/+/192017 Reviewed-by: Robert Griesemer <[email protected]>
1 parent 5e035a0 commit b08568d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/math/big/rat.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ func (x *Rat) Num() *Int {
413413
// Denom returns the denominator of x; it is always > 0.
414414
// The result is a reference to x's denominator; it
415415
// may change if a new value is assigned to x, and vice versa.
416+
// If x's denominator is 1, Denom may materialize the denominator, thereby
417+
// modifying x.
416418
func (x *Rat) Denom() *Int {
417419
x.b.neg = false // the result is always >= 0
418420
if len(x.b.abs) == 0 {

0 commit comments

Comments
 (0)