mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 06:40:37 +01:00
25 lines
626 B
C++
25 lines
626 B
C++
#include <poincare/subtraction.h>
|
|
#include "layout/horizontal_layout.h"
|
|
|
|
Subtraction::Subtraction(Expression * first_operand, Expression * second_operand) {
|
|
m_left = first_operand;
|
|
m_right = second_operand;
|
|
}
|
|
|
|
Subtraction::~Subtraction() {
|
|
delete m_left;
|
|
delete m_right;
|
|
}
|
|
|
|
float Subtraction::approximate(Context& context) {
|
|
return m_left->approximate(context) - m_right->approximate(context);
|
|
}
|
|
|
|
Expression::Type Subtraction::type() {
|
|
return Expression::Type::Subtraction;
|
|
}
|
|
|
|
ExpressionLayout * Subtraction::createLayout(ExpressionLayout * parent) {
|
|
return new HorizontalLayout(parent, m_left, '-', m_right);
|
|
}
|