Added two missing int64 methods (Abs64 and SubAbs64).
This commit is contained in:
parent
82f27a2b4a
commit
9215311802
16
ints/math.go
16
ints/math.go
@ -10,6 +10,14 @@ func Abs(i int) int {
|
||||
return i
|
||||
}
|
||||
|
||||
// Abs64 returns the absolute value of i.
|
||||
func Abs64(i int64) int64 {
|
||||
if 0 > i {
|
||||
return -i
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
// Min returns the minimum of a and b.
|
||||
func Min(a, b int) int {
|
||||
if a < b {
|
||||
@ -72,6 +80,14 @@ func SubAbs(a, b int) int {
|
||||
return b - a
|
||||
}
|
||||
|
||||
// SubAbs64 subtracts a from b and returns the absolute value of the result.
|
||||
func SubAbs64(a, b int64) int64 {
|
||||
if a > b {
|
||||
return a - b
|
||||
}
|
||||
return b - a
|
||||
}
|
||||
|
||||
// Pow returns the power of base b to the exponent e.
|
||||
func Pow(b, e int) int {
|
||||
if 0 == e {
|
||||
|
Loading…
Reference in New Issue
Block a user