mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
26 lines
567 B
C++
26 lines
567 B
C++
#include <poincare/power.h>
|
|
#include <math.h>
|
|
#include "layout/exponent_layout.h"
|
|
|
|
Power::Power(Expression * base, Expression * exponent) :
|
|
m_base(base),
|
|
m_exponent(exponent) {
|
|
}
|
|
|
|
Power::~Power() {
|
|
delete m_exponent;
|
|
delete m_base;
|
|
}
|
|
|
|
float Power::approximate(Context& context) {
|
|
return powf(m_base->approximate(context), m_exponent->approximate(context));
|
|
}
|
|
|
|
Expression::Type Power::type() {
|
|
return Expression::Type::Power;
|
|
}
|
|
|
|
ExpressionLayout * Power::createLayout(ExpressionLayout * parent) {
|
|
return new ExponentLayout(parent, m_base, m_exponent);
|
|
}
|