Documentation ¶
Index ¶
- Constants
- func Clamp[V generic.Number](value, min, max V) V
- func Compare[V generic.Ordered](a V, expression CompareExpression, b V) bool
- func GetDefaultTolerance() float64
- func Max[V generic.Number](a, b V) V
- func MaxMin[V generic.Number](a, b V) (max, min V)
- func Merge[V generic.SignedNumber](refer, a, b V) V
- func Min[V generic.Number](a, b V) V
- func MinMax[V generic.Number](a, b V) (min, max V)
- func Pow(a, n int) int
- func PowInt64(a, n int64) int64
- func Tolerance[V generic.Number](value1, value2, tolerance V) bool
- func UnMerge[V generic.SignedNumber](refer, num V) (a, b V)
- type CompareExpression
Constants ¶
View Source
const (
DefaultTolerance = 0.0001 // 默认误差范围
)
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
func Compare[V generic.Ordered](a V, expression CompareExpression, b V) bool
Compare 根据特定表达式比较两个值
Types ¶
type CompareExpression ¶
type CompareExpression int
CompareExpression 比较表达式
const ( CompareGreaterThan CompareExpression = 1 // 大于 CompareGreaterThanOrEqual CompareExpression = 2 // 大于等于 CompareLessThan CompareExpression = 3 // 小于 CompareLessThanOrEqual CompareExpression = 4 // 小于等于 CompareEqual CompareExpression = 5 // 等于 )
Click to show internal directories.
Click to hide internal directories.