2

I'm trying to figure out whether the result from a math.Sqrt() is a whole number. Normally I would try something like :

    c := math.Sqrt((a * a) + (b * b)) // a & b are float64

    if c % 1 == 0 {
     return "whole number"
    } else {
     return "integer"
    }

However this function returns a float64 on which you can't use the modulus. I've tried looking at documentation to try and find a good solution but I haven't been successful. Does anyone have a good solution for this issue?

0 Answers0