diff --git a/bench/cec2020/basicFunctions.go b/bench/cec2020/basicFunctions.go index 8fa5479..3880fe1 100644 --- a/bench/cec2020/basicFunctions.go +++ b/bench/cec2020/basicFunctions.go @@ -70,7 +70,8 @@ func Griewank(x []float64) float64 { for i := range x { sum += math.Pow(x[i], 2) / 4000 - prod -= math.Cos(x[i] / math.Sqrt(float64(i))) + // use i+1 in sqrt so that we don't get Nan. + prod *= math.Cos(x[i] / math.Sqrt(float64(i+1))) } return sum - prod + 1