CalcEngine: Remove the need to specify base/radix when working with Rational values (#31)

- Separates values from the representation (base/radix) of those values.
- Uses a single base for all values represented as Rationals.
- Rationals are converted to/from a specific base when they are converted to/from strings.
This commit is contained in:
Josh Koon
2019-02-22 10:00:19 -08:00
committed by GitHub
parent 47f9996fa9
commit 73372283a0
14 changed files with 146 additions and 145 deletions

View File

@@ -95,7 +95,7 @@ CCalcEngine::CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager
m_dwWordBitWidth = DwWordBitWidthFromeNumWidth(m_numwidth);
m_maxTrigonometricNum = RationalMath::Pow(10, 100, m_radix, m_precision);
m_maxTrigonometricNum = RationalMath::Pow(10, 100, m_precision);
SetRadixTypeAndNumWidth(DEC_RADIX, m_numwidth);
SettingsChanged();
@@ -118,7 +118,7 @@ void CCalcEngine::InitChopNumbers()
for (size_t i = 0; i < m_chopNumbers.size(); i++)
{
auto maxVal = m_chopNumbers[i].Div(2, m_precision);
maxVal = RationalMath::Integer(maxVal, m_radix, m_precision);
maxVal = RationalMath::Integer(maxVal, m_precision);
m_maxDecimalValueStrings[i] = maxVal.ToString(10, FMT_FLOAT, m_precision);
}