lastValue = Double.NaN;
int lastLevel = 0;
while (! condition.stop(result)) {
Index index = indexGenerator.next();
int level = index.sum();
if (level > lastLevel) {
result.errorEstimate = Math.abs(result.value - lastValue);
lastValue = result.value;
lastLevel = level;
}