return the sum earlier on convergence

This commit is contained in:
Ahmet Inan 2018-03-03 12:17:53 +01:00
commit f1f34d1123

View file

@ -80,7 +80,8 @@ class Kaiser
// double: 35 iterations
for (int n = 1; n < 35; ++n) {
TYPE tmp = x / TYPE(2 * n);
sum(val *= tmp * tmp);
if (sum.same(val *= tmp * tmp))
return sum();
}
return sum();
}