Adding upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c8c64afc61
commit
41a2f19f12
220 changed files with 19814 additions and 0 deletions
36
matrix/util.go
Normal file
36
matrix/util.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package matrix
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func minInt(values ...int) int {
|
||||
min := math.MaxInt32
|
||||
|
||||
for x := 0; x < len(values); x++ {
|
||||
if values[x] < min {
|
||||
min = values[x]
|
||||
}
|
||||
}
|
||||
return min
|
||||
}
|
||||
|
||||
func maxInt(values ...int) int {
|
||||
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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue