Documentation
¶
Overview ¶
Package xmath contains extensions to the standard library package math.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[T constraints.Signed](x T) T
Abs returns the absolute value of x. It panics if this value is not representable, for example because -math.MinInt32 requires more than 32 bits to represent and so does not fit in an int32.
func Clamp ¶
func Clamp[T constraints.Ordered](x, min, max T) T
Clamp clamps the value of x to within min and max.
func Max ¶
func Max[T constraints.Ordered](a, b T) T
Max returns the maximum of a and b based on the > operator.
func Min ¶
func Min[T constraints.Ordered](a, b T) T
Min returns the minimum of a and b based on the < operator.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.