mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 22:00:28 +01:00
[apps/sequence] Avoid infinite loop
Change-Id: Ib84ce244c8faeabc9d71bccd590b3a242cef184c
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user