Fix the operand order of logbasex for consistency (#1115)

* Fix #851: inconsistent operand order for log_y(x)

 - fixed the bug in scioper.cpp
 - changed the related test in CalculatorUnitTests
 - also changed the text in GraphingNumpad

* Change the name of LogBaseX for consistency

basically every occurence is repalced by logbasey, except
for the localized string for narrator, which I left for
the localization team to fix.

* Fix the test

* Revert GraphingNumPad.cpp

* Fixup according to review
This commit is contained in:
dovisutu
2020-04-04 01:34:59 +08:00
committed by GitHub
parent 2705bef6e9
commit 5403adc914
13 changed files with 37 additions and 37 deletions

View File

@@ -35,7 +35,7 @@ namespace
IDC_ADD,2, IDC_SUB,2,
IDC_RSHF,3, IDC_LSHF,3, IDC_RSHFL,3,
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3,
IDC_PWR,4, IDC_ROOT,4, IDC_LOGBASEX,4 };
IDC_PWR,4, IDC_ROOT,4, IDC_LOGBASEY,4 };
for (unsigned int iPrec = 0; iPrec < size(rgbPrec); iPrec += 2)
{
@@ -948,7 +948,7 @@ static const std::unordered_map<int, FunctionNameElement> operatorStringTable =
{ IDC_SIGN, { SIDS_NEGATE } },
{ IDC_DEGREES, { SIDS_DEGREES } },
{ IDC_POW2, { SIDS_TWOPOWX } },
{ IDC_LOGBASEX, { SIDS_LOGBASEX } },
{ IDC_LOGBASEY, { SIDS_LOGBASEY } },
{ IDC_ABS, { SIDS_ABS } },
{ IDC_CEIL, { SIDS_CEIL } },
{ IDC_FLOOR, { SIDS_FLOOR } },

View File

@@ -158,8 +158,8 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
result = Root(rhs, result);
break;
case IDC_LOGBASEX:
result = (Log(result) / Log(rhs));
case IDC_LOGBASEY:
result = (Log(rhs) / Log(result));
break;
}
}

View File

@@ -172,7 +172,7 @@ namespace CalculationManager
CommandCeil = 415,
CommandROLC = 416,
CommandRORC = 417,
CommandLogBaseX = 500,
CommandLogBaseY = 500,
CommandNand = 501,
CommandNor = 502,

View File

@@ -166,7 +166,7 @@
#define IDC_LASTCONTROL IDC_CEIL
#define IDC_BINARYEXTENDEDFIRST 500
#define IDC_LOGBASEX 500 // logx(y)
#define IDC_LOGBASEY 500 // logy(x)
#define IDC_NAND 501 // Nand
#define IDC_NOR 502 // Nor

View File

@@ -196,7 +196,7 @@ inline constexpr auto SIDS_ACSCH = L"InverseCsch";
inline constexpr auto SIDS_COTH = L"Coth";
inline constexpr auto SIDS_ACOTH = L"InverseCoth";
inline constexpr auto SIDS_TWOPOWX = L"TwoPowX";
inline constexpr auto SIDS_LOGBASEX = L"LogBaseX";
inline constexpr auto SIDS_LOGBASEY = L"LogBaseY";
inline constexpr auto SIDS_ABS = L"Abs";
inline constexpr auto SIDS_FLOOR = L"Floor";
inline constexpr auto SIDS_CEIL = L"Ceil";
@@ -352,7 +352,7 @@ inline constexpr std::array<std::wstring_view, 152> g_sids =
SIDS_COTH,
SIDS_ACOTH,
SIDS_TWOPOWX,
SIDS_LOGBASEX,
SIDS_LOGBASEY,
SIDS_ABS,
SIDS_FLOOR,
SIDS_CEIL,