mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-30 04:00:02 +02:00
[poincare] Implement isPositive for symbols Pi and e
Change-Id: I6fb3f605eaf62848b2e90b186c9adb00b330f91d
This commit is contained in:
@@ -34,6 +34,7 @@ public:
|
||||
char name() const;
|
||||
Type type() const override;
|
||||
Expression * clone() const override;
|
||||
bool isPositive() const override;
|
||||
bool isMatrixSymbol() const;
|
||||
private:
|
||||
Evaluation<float> * privateEvaluate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedEvaluate<float>(context, angleUnit); }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "layout/baseline_relative_layout.h"
|
||||
#include "layout/string_layout.h"
|
||||
#include <poincare/complex_matrix.h>
|
||||
#include <ion.h>
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
@@ -53,6 +54,21 @@ Expression * Symbol::clone() const {
|
||||
return new Symbol(m_name);
|
||||
}
|
||||
|
||||
bool Symbol::isPositive() const {
|
||||
/* TODO: Maybe, we will want to know that from a context given in parameter:
|
||||
if (context.expressionForSymbol(this) != nullptr) {
|
||||
return context.expressionForSymbol(this)->isPositive(context);
|
||||
}
|
||||
return false;*/
|
||||
if (m_name == Ion::Charset::SmallPi) {
|
||||
return true;
|
||||
}
|
||||
if (m_name == Ion::Charset::Exponential) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Evaluation<T> * Symbol::templatedEvaluate(Context& context, AngleUnit angleUnit) const {
|
||||
if (context.expressionForSymbol(this) != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user