diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index 25574677b..7274e349d 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -71,7 +71,7 @@ Expression * Calculation::input() { ExpressionLayout * Calculation::inputLayout() { if (m_inputLayout == nullptr && input() != nullptr) { - m_inputLayout = input()->createLayout(Expression::FloatDisplayMode::Decimal, Expression::ComplexFormat::Algebric); + m_inputLayout = input()->createLayout(Expression::FloatDisplayMode::Decimal, Expression::ComplexFormat::Cartesian); } return m_inputLayout; } diff --git a/apps/settings/main_controller.cpp b/apps/settings/main_controller.cpp index c810fe8b1..4af62e86b 100644 --- a/apps/settings/main_controller.cpp +++ b/apps/settings/main_controller.cpp @@ -150,7 +150,7 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) { delete m_complexFormatLayout; m_complexFormatLayout = nullptr; } - if (Preferences::sharedPreferences()->complexFormat() == Expression::ComplexFormat::Algebric) { + if (Preferences::sharedPreferences()->complexFormat() == Expression::ComplexFormat::Cartesian) { const char text[6] = {'a','+', Ion::Charset::IComplex, 'b', ' ', 0}; m_complexFormatLayout = new StringLayout(text, 6, KDText::FontSize::Small); } else { diff --git a/poincare/include/poincare/expression.h b/poincare/include/poincare/expression.h index a078507b4..40c932f27 100644 --- a/poincare/include/poincare/expression.h +++ b/poincare/include/poincare/expression.h @@ -79,7 +79,7 @@ public: Default = 2 }; enum class ComplexFormat { - Algebric = 0, + Cartesian = 0, Polar = 1, Default = 2 }; diff --git a/poincare/src/complex.cpp b/poincare/src/complex.cpp index e541e3b52..2ae4d0aff 100644 --- a/poincare/src/complex.cpp +++ b/poincare/src/complex.cpp @@ -392,7 +392,7 @@ ExpressionLayout * Complex::createPolarLayout(FloatDisplayMode floatDisplayMode) ExpressionLayout * Complex::createCartesianLayout(FloatDisplayMode floatDisplayMode) const { char buffer[k_maxComplexBufferLength]; - int numberOfChars = convertComplexToText(buffer, k_maxComplexBufferLength, floatDisplayMode, ComplexFormat::Algebric); + int numberOfChars = convertComplexToText(buffer, k_maxComplexBufferLength, floatDisplayMode, ComplexFormat::Cartesian); return new StringLayout(buffer, numberOfChars); } diff --git a/poincare/src/preferences.cpp b/poincare/src/preferences.cpp index 312afa20b..f23ad1cdf 100644 --- a/poincare/src/preferences.cpp +++ b/poincare/src/preferences.cpp @@ -7,7 +7,7 @@ static Preferences s_preferences; Preferences::Preferences() : m_angleUnit(Expression::AngleUnit::Degree), m_displayMode(Expression::FloatDisplayMode::Decimal), - m_complexFormat(Expression::ComplexFormat::Algebric) + m_complexFormat(Expression::ComplexFormat::Cartesian) { } diff --git a/poincare/test/complex.cpp b/poincare/test/complex.cpp index b382294a8..fbaae4b38 100644 --- a/poincare/test/complex.cpp +++ b/poincare/test/complex.cpp @@ -8,10 +8,10 @@ using namespace Poincare; constexpr Expression::FloatDisplayMode Decimal = Expression::FloatDisplayMode::Decimal; constexpr Expression::FloatDisplayMode Scientific = Expression::FloatDisplayMode::Scientific; -constexpr Expression::ComplexFormat Algebric = Expression::ComplexFormat::Algebric; +constexpr Expression::ComplexFormat Cartesian = Expression::ComplexFormat::Cartesian; constexpr Expression::ComplexFormat Polar = Expression::ComplexFormat::Polar; -void assert_cartesian_complex_converts_to(float a, float b, const char * result, Expression::FloatDisplayMode mode = Scientific, Expression::ComplexFormat format = Algebric, int significantDigits = 7, int bufferSize = 13+13+7+1) { +void assert_cartesian_complex_converts_to(float a, float b, const char * result, Expression::FloatDisplayMode mode = Scientific, Expression::ComplexFormat format = Cartesian, int significantDigits = 7, int bufferSize = 13+13+7+1) { int tagSize = 8; unsigned char tag = 'X'; char * taggedBuffer = (char *)malloc(bufferSize+2*tagSize); @@ -76,17 +76,17 @@ QUIZ_CASE(poincare_complex_to_text) { * give the exact right number because of float represention. The closest * exact representation is -9.090897E-33. */ assert_cartesian_complex_converts_to(-0.00000000000000000000000000000000909090964f, 0.0f, "-9.090897E-33"); - assert_cartesian_complex_converts_to(123.421f, 0.0f, "123.4", Decimal, Algebric, 4, 6); - assert_cartesian_complex_converts_to(123.421f, 0.0f, "1.2E2", Decimal, Algebric, 5, 6); + assert_cartesian_complex_converts_to(123.421f, 0.0f, "123.4", Decimal, Cartesian, 4, 6); + assert_cartesian_complex_converts_to(123.421f, 0.0f, "1.2E2", Decimal, Cartesian, 5, 6); } QUIZ_CASE(poincare_complex_cartesian_to_text) { - assert_cartesian_complex_converts_to(1.0f, 2.0f, "1+2*i", Decimal, Algebric); + assert_cartesian_complex_converts_to(1.0f, 2.0f, "1+2*i", Decimal, Cartesian); assert_cartesian_complex_converts_to(1.0f, 2.0f, "2.236068*e^(1.107149*i)", Decimal, Polar); - assert_cartesian_complex_converts_to(-1.3f, 2.444f, "-1.3+2.444*i", Decimal, Algebric); + assert_cartesian_complex_converts_to(-1.3f, 2.444f, "-1.3+2.444*i", Decimal, Cartesian); assert_cartesian_complex_converts_to(-1.3f, 2.444f, "2.768237*e^(2.059649*i)", Decimal, Polar); - assert_cartesian_complex_converts_to(-1.3f, -2.444f, "-1.3-2.444*i", Decimal, Algebric); - assert_cartesian_complex_converts_to(64078208.0f, 119229408.0f, "6.407821E7+1.192294E8*i", Decimal, Algebric); + assert_cartesian_complex_converts_to(-1.3f, -2.444f, "-1.3-2.444*i", Decimal, Cartesian); + assert_cartesian_complex_converts_to(64078208.0f, 119229408.0f, "6.407821E7+1.192294E8*i", Decimal, Cartesian); assert_cartesian_complex_converts_to(64078208.0f, 119229408.0f, "1.353576E8*e^(1.07765*i)", Decimal, Polar); }