Change-Id: I208c8ac44d1a8882d8fdeb18347dc20941e20374
Reviewed-on: https://go-review.googlesource.com/4250
Reviewed-by: Alan Donovan <adonovan@google.com>
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.
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)
}
}
func umax(x, y uint) uint {
- if x < y {
+ if x > y {
return x
}
return y