7 CalculationStore::CalculationStore() :
13 Calculation * result = &m_calculations[m_startIndex];
24 Calculation * currentCalc = &m_calculations[m_startIndex];
27 if (!currentCalc++->isEmpty()) {
28 previousCalc = currentCalc - 1;
32 currentCalc = m_calculations;
42 if (!currentCalc++->isEmpty()) {
51 assert(i >= 0 && i < numberOfCalc);
52 int indexFirstCalc = m_startIndex;
53 while (m_calculations[indexFirstCalc].isEmpty()) {
58 assert(indexFirstCalc != m_startIndex);
60 int absoluteIndexCalculationI = indexFirstCalc+i;
63 int index = absoluteIndexCalculationI;
64 for (
int k = i; k < numberOfCalc-1; k++) {
66 m_calculations[index] = m_calculations[nextIndex];
72 m_calculations[index].
reset();
74 if (m_startIndex == -1) {
82 m_calculations[i].
reset();
88 m_calculations[i].
tidy();
94 static Rational defaultExpression(0);
95 return &defaultExpression;
103 bool exactOuptutInvolvesStore = lastCalculation->exactOutput(context)->recursivelyMatches([](
const Expression * e,
Context & context) {
104 return e->
type() == Expression::Type::Store;
106 if (lastCalculation->input()->isApproximate(*context) || exactOuptutInvolvesStore) {
107 return lastCalculation->approximateOutput(context);
109 return lastCalculation->exactOutput(context);
Calculation * push(const char *text, Poincare::Context *context)
Calculation * calculationAtIndex(int i)
void deleteCalculationAtIndex(int i)
static constexpr int k_maxNumberOfCalculations
int numberOfCalculations()
Poincare::Expression * ansExpression(Poincare::Context *context)
virtual Type type() const =0