mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-31 03:50:02 -07:00
Update Calc Engine for new functions needed for keyboard refresh (#662)
* Update Calc Engine to Support New Functionality * Address PR comments * Address PR comments
This commit is contained in:
parent
d9bf57ff99
commit
9cb0932eaa
22 changed files with 849 additions and 176 deletions
|
@ -28,6 +28,14 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
|||
result ^= rhs;
|
||||
break;
|
||||
|
||||
case IDC_NAND:
|
||||
result = (result & rhs) ^ m_chopNumbers[m_numwidth];
|
||||
break;
|
||||
|
||||
case IDC_NOR:
|
||||
result = (result | rhs) ^ m_chopNumbers[m_numwidth];
|
||||
break;
|
||||
|
||||
case IDC_RSHF:
|
||||
{
|
||||
if (m_fIntegerMode && result >= m_dwWordBitWidth) // Lsh/Rsh >= than current word size is always 0
|
||||
|
@ -52,7 +60,16 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
|||
}
|
||||
break;
|
||||
}
|
||||
case IDC_RSHFL:
|
||||
{
|
||||
if (m_fIntegerMode && result >= m_dwWordBitWidth) // Lsh/Rsh >= than current word size is always 0
|
||||
{
|
||||
throw CALC_E_NORESULT;
|
||||
}
|
||||
|
||||
result = rhs >> result;
|
||||
break;
|
||||
}
|
||||
case IDC_LSHF:
|
||||
if (m_fIntegerMode && result >= m_dwWordBitWidth) // Lsh/Rsh >= than current word size is always 0
|
||||
{
|
||||
|
@ -140,6 +157,10 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
|||
case IDC_ROOT: // Calculates rhs to the result(th) root.
|
||||
result = Root(rhs, result);
|
||||
break;
|
||||
|
||||
case IDC_LOGBASEX:
|
||||
result = (Log(result) / Log(rhs));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (uint32_t dwErrCode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue