Documentation
¶
Overview ¶
Package ordered contains generic utility functions over ordered types, i.e. types that support the operators <, >, == etc.
Index ¶
- Variables
- func Abs[T Real](n T) T
- func Add[R Real, T Real](x, y T) R
- func IsInteger[T Real](n T) bool
- func Max[T cmp.Ordered](xs ...T) T
- func Max2[T cmp.Ordered](x1, x2 T) T
- func Min[T cmp.Ordered](xs ...T) T
- func Min2[T cmp.Ordered](x1, x2 T) T
- func Precision[T Real](v T) int
- func Sub[R Real, T Real](x, y T) R
- type Real
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptySlice = errors.New("no elements in slice")
View Source
var ErrUnknownType = errors.New("uknown type")
Functions ¶
func Max ¶
Max returns the largest of one or more ordered values. Note the values can be strings as well as numeric types.
func Min ¶
Max returns the smallest of one or more ordered values. Note the values can be strings as well as numeric types.
Types ¶
type Real ¶
type Real interface {
constraints.Float | constraints.Integer
}
Scalar numeric type constraint. Includes all floating and integer types.
Click to show internal directories.
Click to hide internal directories.