[apps/sequence] Avoid infinite loop

Change-Id: Ib84ce244c8faeabc9d71bccd590b3a242cef184c
This commit is contained in:
Émilie Feral
2017-05-10 15:19:47 +02:00
parent 0b41f96fb6
commit f81ae8d5e5

View File

@@ -309,6 +309,11 @@ float Sequence::sumOfTermsBetweenAbscissa(float start, float end, Context * cont
return NAN;
}
for (float i = roundf(start); i <= roundf(end); i = i + 1.0f) {
/* When |start| >> 1.0f, start + 1.0f = start. In that case, quit the
* infinite loop. */
if (i == i-1.0f || i == i+1.0f) {
return NAN;
}
result += evaluateAtAbscissa(i, context);
}
return result;