You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the application I'm working on, I came across a requirement to find out whether one float was divisible by another. I tried doing this by using the math.Mod and math.Remainder method to check if the result == 0.0.
package main
import"fmt"import"math"funcmain() {
fmt.Println(math.Remainder(2000.0, 0.01))
fmt.Println(math.Mod(2000.0, 0.01))
}
As you can see in this playground sample, neither of those work perfectly. While I was able to hack away the problem by a rather cumbersome hack, I think it would be pretty useful if the go standard library provides a method to check if a float is divisible by another.