[apps:sequence] Avoid infinite loop when computing sum of terms

Change-Id: I5264f86edd6d0464691e354e85aa136a037f358c
This commit is contained in:
Émilie Feral
2017-04-27 10:47:29 +02:00
parent ffcc6b50a8
commit de6d17e432

View File

@@ -272,7 +272,7 @@ float Sequence::evaluateAtAbscissa(float x, Poincare::Context * context) const {
float Sequence::sumOfTermsBetweenAbscissa(float start, float end, Context * context) {
float result = 0.0f;
if (end-start > k_maxNumberOfTermsInSum) {
if (end-start > k_maxNumberOfTermsInSum || start + 1.0f == start) {
return NAN;
}
for (float i = roundf(start); i <= roundf(end); i = i + 1.0f) {