mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2026-04-23 00:07:09 +08:00
9 lines
132 B
Go
9 lines
132 B
Go
package mathx
|
|
|
|
import "math"
|
|
|
|
// Abs 返回一个数的绝对值
|
|
func Abs[T Numeric](num T) T {
|
|
return T(math.Abs(float64(num)))
|
|
}
|