Documentation
¶
Overview ¶
Contains mathematic functions.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Between ¶
func Between[T constraints.Ordered](v, min, max T) bool
Between returns true if the value is between max and min.
Example ¶
fmt.Println(Between(1, 10, 100)) fmt.Println(Between(110, 10, 100)) fmt.Println(Between(11, 10, 100))
Output: false false true
func Max ¶
func Max[T constraints.Ordered](v1, v2 T) T
Max returns maximum value.
Example ¶
fmt.Println(Max(1, 10)) fmt.Println(Max(11, 10))
Output: 10 11
func Min ¶
func Min[T constraints.Ordered](v1, v2 T) T
Min returns minimum value.
Example ¶
fmt.Println(Min(1, 10)) fmt.Println(Min(11, 10))
Output: 1 10
func MustBetween ¶
func MustBetween[T constraints.Ordered](v, min, max T) T
MustBetween returns the value between max and min.
Example ¶
fmt.Println(MustBetween(1, 10, 100)) fmt.Println(MustBetween(11, 10, 100)) fmt.Println(MustBetween(110, 10, 100))
Output: 10 11 100
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.