mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Beitragsansicht
This commit is contained in:
15
helpers/datatypes/float64.go
Normal file
15
helpers/datatypes/float64.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package datatypes
|
||||
|
||||
import "math"
|
||||
|
||||
const float64EqualityThreshold = 1e-9
|
||||
|
||||
func CompareFloat(a, b float64) int {
|
||||
if math.Abs(a-b) < float64EqualityThreshold {
|
||||
return 0
|
||||
}
|
||||
if a < b {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
Reference in New Issue
Block a user