func isFloatInt(floatValue float64) bool{
//What's the implementation here?
}
Test cases:
input: 1.5 output: false;
input: 1 output: true;
input:1.0 output: true;
func isFloatInt(floatValue float64) bool{
//What's the implementation here?
}
Test cases:
input: 1.5 output: false;
input: 1 output: true;
input:1.0 output: true;
I just checked on the playground, this does the right thing with NaN as well.
func isIntegral(val float64) bool {
return val == float64(int(val))
}
You could achieve it by doing a modulus
func isFloatInt(floatValue float64) bool {
return math.Mod(floatValue, 1.0) == 0
}