]> Cypherpunks repositories - gostls13.git/commit
math/big: make Rat.Denom() always return a reference
authorRobert Griesemer <gri@golang.org>
Thu, 24 May 2012 17:49:38 +0000 (10:49 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 24 May 2012 17:49:38 +0000 (10:49 -0700)
commit07612b8db012efadc2a9182160ba54702d9d04bf
tree815d1887a470278608507133a3a1c3e7df7b7efb
parent3d3b4906f94a40b7dd2e66ad3ad48e86b5ce6f89
math/big: make Rat.Denom() always return a reference

The documentation says so, but in the case of a normalized
integral Rat, the denominator was a new value. Changed the
internal representation to use an Int to represent the
denominator (with the sign ignored), so a reference to it
can always be returned.

Clarified documentation and added test cases.

Fixes #3521.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6237045
src/pkg/math/big/rat.go
src/pkg/math/big/rat_test.go