Q:

Floor division in go

I'm translating some old come from Python to Go. In this code, I used the floor division with the floor operator in Python.
d = b // c
# (c isn't a comment, I use the // operator from python)

My problem is, this operator doesn't exist in Go. What's the easiest way to translate in Go?

A:

If b and c are integers, b / c is already the floor division. If they are float64s, use math.Floor(b/c). If using float32 (or any other numeric type), you must convert first: math.Floor(float64(b)/float64(c))

