package util import ( "golang.org/x/exp/constraints" ) type Numeric interface { constraints.Float | constraints.Integer } func Abs[T Numeric](a T) T { if a < 0 { return -a } return a }