[apps/shared] Move sumBetweenBounds from controller (SumGraphController)

to the models (Sequence or CartesianFunction) and
CartesianFunction::sumBetweenBounds takes into account the function
domain
This commit is contained in:
Émilie Feral
2019-09-09 11:41:11 +02:00
parent 8185656870
commit f38c6ed3d1
11 changed files with 21 additions and 17 deletions

View File

@@ -4,6 +4,7 @@
#include <poincare/layout_helper.h>
#include <poincare/serialization_helper.h>
#include <poincare/code_point_layout.h>
#include <poincare/sum.h>
#include <poincare/vertical_offset_layout.h>
#include <poincare/integer.h>
#include "../shared/poincare_helpers.h"
@@ -190,6 +191,10 @@ T Sequence::approximateToNextRank(int n, SequenceContext * sqctx) const {
}
}
Expression Sequence::sumBetweenBounds(double start, double end, Poincare::Context * context) const {
return Poincare::Sum::Builder(expressionReduced(context).clone(), Poincare::Symbol::Builder(UCodePointUnknownX), Poincare::Float<double>::Builder(start), Poincare::Float<double>::Builder(end)); // Sum takes ownership of args
}
Sequence::SequenceRecordDataBuffer * Sequence::recordData() const {
assert(!isNull());
Ion::Storage::Record::Data d = value();