gl01/internal/util/mod.go

21 lines
276 B
Go
Raw Normal View History

2022-01-20 21:58:50 +08:00
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
}