aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2015-02-09 11:26:56 -0800
committerRobert Griesemer <gri@golang.org>2015-02-09 19:32:12 +0000
commit04ce9dbf355a5d1b2e0b979d02f16ef2bf83833f (patch)
treee62a5796e96a487807c368fc29858e533855e00e /src/math
parentf8176f81115b5b9b58ddfe4b37e0565fd599fecd (diff)
downloadgo-04ce9dbf355a5d1b2e0b979d02f16ef2bf83833f.tar.xz
math/big: correct umax
Change-Id: I208c8ac44d1a8882d8fdeb18347dc20941e20374 Reviewed-on: https://go-review.googlesource.com/4250 Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/math')
-rw-r--r--src/math/big/float.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/math/big/float.go b/src/math/big/float.go
index f49d5b2fe5..d280916d0d 100644
--- a/src/math/big/float.go
+++ b/src/math/big/float.go
@@ -439,7 +439,7 @@ func (z *Float) SetInt64(x int64) *Float {
return z
}
-// SetInt64 sets z to the (possibly rounded) value of x and returns z.
+// SetFloat64 sets z to the (possibly rounded) value of x and returns z.
// If z's precision is 0, it is changed to 53 (and rounding will have
// no effect).
// If x is denormalized or NaN, the result is unspecified.
@@ -525,8 +525,7 @@ func (z *Float) SetRat(x *Rat) *Float {
a.SetInt(x.Num())
b.SetInt(x.Denom())
if z.prec == 0 {
- // TODO(gri) think about a.prec type to avoid excessive conversions
- z.prec = uint(max(int(a.prec), int(b.prec)))
+ z.prec = umax(a.prec, b.prec)
}
return z.Quo(&a, &b)
}
@@ -1072,7 +1071,7 @@ func (x *Float) Sign() int {
}
func umax(x, y uint) uint {
- if x < y {
+ if x > y {
return x
}
return y