Use math.Hypot()
Replace math.Pow(x,2) with x*x