mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Change multiplication sign
Change-Id: If58f62fa181ce7aac441d42d44ea65d68f0d6421
This commit is contained in:
@@ -22,6 +22,8 @@ enum Charset : char {
|
||||
Root = (char)144,
|
||||
LessEqual = (char)145,
|
||||
GreaterEqual = (char)146,
|
||||
MultiplicationSign = (char)147,
|
||||
MiddleDot = (char)148,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ static constexpr const char k_complexI[2] = {Ion::Charset::IComplex, 0};
|
||||
static constexpr const char k_exponential[5] = {Ion::Charset::Exponential, '^', '(', ')', 0};
|
||||
static constexpr const char k_sto[2] = {Ion::Charset::Sto, 0};
|
||||
static constexpr const char k_exponent[2] = {Ion::Charset::Exponent, 0};
|
||||
static constexpr const char k_multiplicationSign[2] = {Ion::Charset::MultiplicationSign, 0};
|
||||
|
||||
static constexpr EventData s_dataForEvent[4*Event::PageSize] = {
|
||||
// Plain
|
||||
@@ -40,7 +41,7 @@ static constexpr EventData s_dataForEvent[4*Event::PageSize] = {
|
||||
T(k_exponential), T("ln()"), T("log()"), T(k_complexI), T(","), T("^"),
|
||||
T("sin()"), T("cos()"), T("tan()"), T(k_pi), T(k_root), T("^2"),
|
||||
T("7"), T("8"), T("9"), T("("), T(")"), U(),
|
||||
T("4"), T("5"), T("6"), T("*"), T("/"), U(),
|
||||
T("4"), T("5"), T("6"), T(k_multiplicationSign), T("/"), U(),
|
||||
T("1"), T("2"), T("3"), T("+"), T("-"), U(),
|
||||
T("0"), T("."), T(k_exponent), TL(), TL(), U(),
|
||||
// Shift
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
wchar_t codePointForSymbol[NUMBER_OF_SYMBOLS] = {0x222b, 0x0078, 0x0305,
|
||||
0x0079, 0x0305, 0x0393, 0x03a3, 0x03b8, 0x03bb, 0x03bc, 0x03c0, 0x03c3, 0x0456,
|
||||
0x1D07, 0x2032, 0x212e, 0x2192, 0x221A, 0x2264, 0x2265};
|
||||
0x1D07, 0x2032, 0x212e, 0x2192, 0x221A, 0x2264, 0x2265, 0x00D7, 0x00B7};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define NUMBER_OF_SYMBOLS 20
|
||||
#define NUMBER_OF_SYMBOLS 22
|
||||
|
||||
extern wchar_t codePointForSymbol[NUMBER_OF_SYMBOLS];
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
int writeTextInBuffer(char * buffer, int bufferSize) const override {
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, name());
|
||||
}
|
||||
const char * name() const { return "+"; }
|
||||
static const char * name() { return "+"; }
|
||||
/* Simplification */
|
||||
Expression * immediateBeautify(Context & context, AngleUnit angleUnit) override;
|
||||
Expression * factorizeOnCommonDenominator(Context & context, AngleUnit angleUnit);
|
||||
|
||||
@@ -33,8 +33,9 @@ private:
|
||||
|
||||
ExpressionLayout * privateCreateLayout(FloatDisplayMode floatDisplayMode, ComplexFormat complexFormat) const override;
|
||||
int writeTextInBuffer(char * buffer, int bufferSize) const override {
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, "/");
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, name());
|
||||
}
|
||||
static const char * name() { return "/"; }
|
||||
Expression * factorOfTypeInOperand(Type type, int operandIndex, int k);
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
int writeTextInBuffer(char * buffer, int bufferSize) const override {
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, name());
|
||||
}
|
||||
const char * name() const { return "*"; }
|
||||
static const char * name();
|
||||
/* Simplification */
|
||||
void factorize(Context & context, AngleUnit angleUnit);
|
||||
void factorizeBase(Expression * e1, Expression * e2, Context & context, AngleUnit angleUnit);
|
||||
|
||||
@@ -35,9 +35,9 @@ private:
|
||||
|
||||
ExpressionLayout * privateCreateLayout(FloatDisplayMode floatDisplayMode, ComplexFormat complexFormat) const override;
|
||||
int writeTextInBuffer(char * buffer, int bufferSize) const override {
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, "^");
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, name());
|
||||
}
|
||||
|
||||
static const char * name() { return "^"; }
|
||||
int compareToGreaterTypeExpression(const Expression * e) const override;
|
||||
int compareToSameTypeExpression(const Expression * e) const override;
|
||||
/* Simplification */
|
||||
|
||||
@@ -38,7 +38,7 @@ private:
|
||||
int writeTextInBuffer(char * buffer, int bufferSize) const override {
|
||||
return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, name());
|
||||
}
|
||||
const char * name() const { return "-"; }
|
||||
static const char * name() { return "-"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ inf { poincare_expression_yylval.expression = new Undefined(); return UNDEFINED;
|
||||
\x8f { return STO; }
|
||||
\+ { return PLUS; }
|
||||
\- { return MINUS; }
|
||||
\x93 { return MULTIPLY; }
|
||||
\* { return MULTIPLY; }
|
||||
\/ { return DIVIDE; }
|
||||
\^ { return POW; }
|
||||
|
||||
@@ -14,6 +14,7 @@ extern "C" {
|
||||
#include <poincare/parenthesis.h>
|
||||
#include <poincare/subtraction.h>
|
||||
#include <poincare/division.h>
|
||||
#include <ion.h>
|
||||
#include "layout/string_layout.h"
|
||||
#include "layout/horizontal_layout.h"
|
||||
#include "layout/parenthesis_layout.h"
|
||||
@@ -361,6 +362,11 @@ void Multiplication::leastCommonMultiple(Expression * factor, Context & context,
|
||||
sortChildren();
|
||||
}
|
||||
|
||||
static_assert('\x94' == Ion::Charset::MiddleDot, "Unicode error");
|
||||
const char * Multiplication::name() {
|
||||
return "\x94";
|
||||
}
|
||||
|
||||
template Poincare::Evaluation<float>* Poincare::Multiplication::computeOnComplexAndMatrix<float>(Poincare::Complex<float> const*, Poincare::Evaluation<float>*);
|
||||
template Poincare::Evaluation<double>* Poincare::Multiplication::computeOnComplexAndMatrix<double>(Poincare::Complex<double> const*, Poincare::Evaluation<double>*);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ Expression * SquareRoot::clone() const {
|
||||
return a;
|
||||
}
|
||||
|
||||
static_assert('\x90' == Ion::Charset::Root, "Incorrect");
|
||||
static_assert('\x90' == Ion::Charset::Root, "Unicode error");
|
||||
int SquareRoot::writeTextInBuffer(char * buffer, int bufferSize) const {
|
||||
return LayoutEngine::writePrefixExpressionTextInBuffer(this, buffer, bufferSize, "\x90");
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ extern "C" {
|
||||
#include <poincare/context.h>
|
||||
#include "layout/horizontal_layout.h"
|
||||
#include "layout/string_layout.h"
|
||||
#include <ion.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ Expression * Trigonometry::immediateSimplify(Context& context, AngleUnit angleUn
|
||||
return this;
|
||||
}
|
||||
|
||||
static_assert('\x89' == Ion::Charset::SmallPi, "Incorrect");
|
||||
static_assert('\x89' == Ion::Charset::SmallPi, "Unicode error");
|
||||
constexpr const char * cheatTable[Trigonometry::k_numberOfEntries][3] =
|
||||
{{"\x89", "\x89*(-2)^(-1)", "-1"},
|
||||
{"\x89*11*12^(-1)", "\x89*(-5)*12^(-1)", "(-1)*6^(1/2)*4^(-1)-2^(1/2)*4^(-1)"},
|
||||
|
||||
@@ -34,6 +34,7 @@ void assert_parsed_expression_simplify_to(const char * expression, const char *
|
||||
|
||||
|
||||
QUIZ_CASE(poincare_simplify_easy) {
|
||||
assert_parsed_expression_simplify_to("X^(P)*X^(5)", "X^(P+5)");
|
||||
assert_parsed_expression_simplify_to("0000.000000", "0");
|
||||
assert_parsed_expression_simplify_to(".000000", "0");
|
||||
assert_parsed_expression_simplify_to("0000", "0");
|
||||
|
||||
Reference in New Issue
Block a user