mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] improve the sum layout
Change-Id: I59149dfd618b3882a906aac3a0497e62c8eb7d91
This commit is contained in:
@@ -11,6 +11,7 @@ public:
|
||||
Type type() const override;
|
||||
Expression * cloneWithDifferentOperands(Expression ** newOperands,
|
||||
int numberOfOperands, bool cloneOperands = true) const override;
|
||||
ExpressionLayout * createLayout() const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include <poincare/sum.h>
|
||||
#include <poincare/symbol.h>
|
||||
#include <poincare/float.h>
|
||||
|
||||
#include "layout/sum_layout.h"
|
||||
#include "layout/string_layout.h"
|
||||
#include "layout/horizontal_layout.h"
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
}
|
||||
|
||||
Sum::Sum() :
|
||||
@@ -37,3 +40,10 @@ float Sum::approximate(Context& context) const {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ExpressionLayout * Sum::createLayout() const {
|
||||
ExpressionLayout ** childrenLayouts = (ExpressionLayout **)malloc(2*sizeof(ExpressionLayout *));
|
||||
childrenLayouts[0] = new StringLayout("n=", 2);
|
||||
childrenLayouts[1] = m_args[1]->createLayout();
|
||||
return new SumLayout(new HorizontalLayout(childrenLayouts, 2), m_args[2]->createLayout(), m_args[0]->createLayout());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user