21 lines
276 B
Go
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
|
|
}
|