mirror of
https://github.com/golang/go
synced 2024-11-17 09:04:44 -07:00
math/big: document that Rat.Denom might modify the receiver
Fixes #33792 Change-Id: I306a95883c3db2d674d3294a6feb50adc50ee5d6 Reviewed-on: https://go-review.googlesource.com/c/go/+/192017 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
307544f427
commit
9dfa4cb026
@ -413,6 +413,8 @@ func (x *Rat) Num() *Int {
|
|||||||
// Denom returns the denominator of x; it is always > 0.
|
// Denom returns the denominator of x; it is always > 0.
|
||||||
// The result is a reference to x's denominator; it
|
// The result is a reference to x's denominator; it
|
||||||
// may change if a new value is assigned to x, and vice versa.
|
// 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 {
|
func (x *Rat) Denom() *Int {
|
||||||
x.b.neg = false // the result is always >= 0
|
x.b.neg = false // the result is always >= 0
|
||||||
if len(x.b.abs) == 0 {
|
if len(x.b.abs) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user