gmath/limits.go

20 lines
227 B
Go
Raw Normal View History

2022-08-16 12:23:03 +02:00
package gmath
func Min[N Number](a, b N) N {
if a < b {
return a
}
return b
}
func Max[N Number](a, b N) N {
if a > b {
return a
}
return b
}
2022-08-21 20:08:34 +02:00
func Clamp[N Number](v, min, max N) N {
2022-08-16 12:23:03 +02:00
return Min(Max(v, min), max)
}