[apps/sequence/graph] Improve term sum controller

Change-Id: Ic2b81e7f1c608e5a9f4f8c5a8de116433f930042
This commit is contained in:
Émilie Feral
2017-02-23 17:22:21 +01:00
parent 43f17faa2e
commit f57d633c08
8 changed files with 159 additions and 28 deletions

View File

@@ -173,7 +173,6 @@ bool Sequence::isDefined() {
}
}
float Sequence::evaluateAtAbscissa(float x, Poincare::Context * context) const {
float n = roundf(x);
switch (m_type) {
@@ -229,4 +228,12 @@ float Sequence::evaluateAtAbscissa(float x, Poincare::Context * context) const {
}
}
float Sequence::sumOfTermsBetweenAbscissa(float start, float end, Context * context) {
float result = 0.0f;
for (float i = roundf(start); i <= roundf(end); i = i + 1.0f) {
result += evaluateAtAbscissa(i, context);
}
return result;
}
}