package comp // Abs calculates the absolute value. // TODO: Replace by a built-in generic version once available. func Abs[T OrderedNumber](x T) T { if x < 0 { return -x } return x }