2017-04-18 23:20:29 -04:00
|
|
|
package matrix
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
2022-01-10 18:52:32 -05:00
|
|
|
func Min(values ...int) int {
|
2017-04-18 23:20:29 -04:00
|
|
|
min := math.MaxInt32
|
|
|
|
|
|
|
|
for x := 0; x < len(values); x++ {
|
|
|
|
if values[x] < min {
|
|
|
|
min = values[x]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return min
|
|
|
|
}
|
|
|
|
|
2022-01-10 18:52:32 -05:00
|
|
|
func Max(values ...int) int {
|
2017-04-18 23:20:29 -04:00
|
|
|
max := math.MinInt32
|
|
|
|
|
|
|
|
for x := 0; x < len(values); x++ {
|
|
|
|
if values[x] > max {
|
|
|
|
max = values[x]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return max
|
|
|
|
}
|
|
|
|
|
|
|
|
func f64s(v float64) string {
|
|
|
|
return strconv.FormatFloat(v, 'f', -1, 64)
|
|
|
|
}
|
|
|
|
|
|
|
|
func roundToEpsilon(value, epsilon float64) float64 {
|
|
|
|
return math.Nextafter(value, value)
|
|
|
|
}
|