gl01/internal/util/mod.go
2022-01-20 21:58:50 +08:00

21 lines
276 B
Go

package util
func FloatModf(val, mod float32) float32 {
for val > mod {
val -= mod
}
for val < 0 {
val += mod
}
return val
}
func FloatModd(val, mod float64) float64 {
for val > mod {
val -= mod
}
for val < 0 {
val += mod
}
return val
}