Add a simple absolute value function.
This commit is contained in:
parent
28998c5d14
commit
bd7cc5ce68
8
2018/internal/util/math.go
Normal file
8
2018/internal/util/math.go
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package util
|
||||||
|
|
||||||
|
func abs(x int) int {
|
||||||
|
if x < 0 {
|
||||||
|
return -x
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user