mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 05:43:10 -07:00
Move Operator functions from RationalMath namespace into member functions of Rational
This commit is contained in:
parent
22257ab042
commit
87068043dc
10 changed files with 313 additions and 314 deletions
|
@ -31,7 +31,7 @@ namespace CalcEngine
|
||||||
m_q{ q }
|
m_q{ q }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Rational::Rational(int32_t i) noexcept
|
Rational::Rational(int32_t i)
|
||||||
{
|
{
|
||||||
PRAT pr = longtorat(static_cast<long>(i));
|
PRAT pr = longtorat(static_cast<long>(i));
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace CalcEngine
|
||||||
destroyrat(pr);
|
destroyrat(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational::Rational(uint32_t ui) noexcept
|
Rational::Rational(uint32_t ui)
|
||||||
{
|
{
|
||||||
PRAT pr = Ulongtorat(static_cast<unsigned long>(ui));
|
PRAT pr = Ulongtorat(static_cast<unsigned long>(ui));
|
||||||
|
|
||||||
|
@ -51,13 +51,12 @@ namespace CalcEngine
|
||||||
destroyrat(pr);
|
destroyrat(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational::Rational(uint64_t ui, uint32_t radix, int32_t precision) noexcept
|
Rational::Rational(uint64_t ui, uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
uint32_t hi = HIDWORD(ui);
|
uint32_t hi = HIDWORD(ui);
|
||||||
uint32_t lo = LODWORD(ui);
|
uint32_t lo = LODWORD(ui);
|
||||||
|
|
||||||
Rational temp = Lsh(hi, 32, radix, precision);
|
Rational temp = Rational{ hi }.Lsh(32, radix, precision).Or(lo, radix, precision);
|
||||||
temp = Or(temp, lo, radix, precision);
|
|
||||||
|
|
||||||
m_p = Number{ temp.P() };
|
m_p = Number{ temp.P() };
|
||||||
m_q = Number{ temp.Q() };
|
m_q = Number{ temp.Q() };
|
||||||
|
@ -88,6 +87,248 @@ namespace CalcEngine
|
||||||
return m_q;
|
return m_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rational Rational::Negate() const
|
||||||
|
{
|
||||||
|
return Rational{ Number{ -1 * m_p.Sign(), m_p.Exp(), m_p.Mantissa() }, m_q};
|
||||||
|
}
|
||||||
|
Rational Rational::Add(Rational const& rhs, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
addrat(&lhsRat, rhsRat, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Sub(Rational const& rhs, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
subrat(&lhsRat, rhsRat, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Mul(Rational const& rhs, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mulrat(&lhsRat, rhsRat, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Div(Rational const& rhs, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
divrat(&lhsRat, rhsRat, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Mod(Rational const& rhs) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
modrat(&lhsRat, rhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational Rational::Lsh(Rational const& rhs, uint32_t radix, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lshrat(&lhsRat, rhsRat, radix, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Rsh(Rational const& rhs, uint32_t radix, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
rshrat(&lhsRat, rhsRat, radix, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational Rational::Not(bool isIntegerMode, Rational const& chopNum, uint32_t radix, int32_t precision) const
|
||||||
|
{
|
||||||
|
Rational result{};
|
||||||
|
|
||||||
|
if (radix == 10 && !isIntegerMode)
|
||||||
|
{
|
||||||
|
result = RationalMath::Integer(*this, radix, precision);
|
||||||
|
result = result.Add(1, precision);
|
||||||
|
result = result.Negate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = this->Xor(chopNum, radix, precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::And(Rational const& rhs, uint32_t radix, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
andrat(&lhsRat, rhsRat, radix, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Or(Rational const& rhs, uint32_t radix, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
orrat(&lhsRat, rhsRat, radix, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Rational Rational::Xor(Rational const& rhs, uint32_t radix, int32_t precision) const
|
||||||
|
{
|
||||||
|
PRAT lhsRat = this->ToPRAT();
|
||||||
|
PRAT rhsRat = rhs.ToPRAT();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
xorrat(&lhsRat, rhsRat, radix, precision);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
}
|
||||||
|
catch (DWORD error)
|
||||||
|
{
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
destroyrat(rhsRat);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rational result = Rational{ lhsRat };
|
||||||
|
destroyrat(lhsRat);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool Rational::IsZero() const
|
bool Rational::IsZero() const
|
||||||
{
|
{
|
||||||
return this->P().IsZero();
|
return this->P().IsZero();
|
||||||
|
|
|
@ -117,7 +117,7 @@ void CCalcEngine::InitChopNumbers()
|
||||||
assert(m_chopNumbers.size() == m_maxDecimalValueStrings.size());
|
assert(m_chopNumbers.size() == m_maxDecimalValueStrings.size());
|
||||||
for (size_t i = 0; i < m_chopNumbers.size(); i++)
|
for (size_t i = 0; i < m_chopNumbers.size(); i++)
|
||||||
{
|
{
|
||||||
auto maxVal = RationalMath::Div(m_chopNumbers[i], 2, m_precision);
|
auto maxVal = m_chopNumbers[i].Div(2, m_precision);
|
||||||
maxVal = RationalMath::Integer(maxVal, m_radix, m_precision);
|
maxVal = RationalMath::Integer(maxVal, m_radix, m_precision);
|
||||||
|
|
||||||
m_maxDecimalValueStrings[i] = maxVal.ToString(10, FMT_FLOAT, m_precision);
|
m_maxDecimalValueStrings[i] = maxVal.ToString(10, FMT_FLOAT, m_precision);
|
||||||
|
|
|
@ -692,7 +692,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||||
m_HistoryCollector.AddOpndToHistory(m_numberString, m_currentVal);
|
m_HistoryCollector.AddOpndToHistory(m_numberString, m_currentVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentVal = Negate(m_currentVal);
|
m_currentVal = m_currentVal.Negate();
|
||||||
|
|
||||||
DisplayNum();
|
DisplayNum();
|
||||||
m_HistoryCollector.AddUnaryOpToHistory(IDC_SIGN, m_bInv, m_angletype);
|
m_HistoryCollector.AddUnaryOpToHistory(IDC_SIGN, m_bInv, m_angletype);
|
||||||
|
@ -719,7 +719,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||||
{
|
{
|
||||||
/* MPLUS adds m_currentVal to immediate memory and kills the "mem" */
|
/* MPLUS adds m_currentVal to immediate memory and kills the "mem" */
|
||||||
/* indicator if the result is zero. */
|
/* indicator if the result is zero. */
|
||||||
Rational result = Add(*m_memoryValue, m_currentVal, m_precision);
|
Rational result = (*m_memoryValue).Add(m_currentVal, m_precision);
|
||||||
m_memoryValue = make_unique<Rational>(TruncateNumForIntMath(result)); // Memory should follow the current int mode
|
m_memoryValue = make_unique<Rational>(TruncateNumForIntMath(result)); // Memory should follow the current int mode
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -728,7 +728,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||||
{
|
{
|
||||||
/* MMINUS subtracts m_currentVal to immediate memory and kills the "mem" */
|
/* MMINUS subtracts m_currentVal to immediate memory and kills the "mem" */
|
||||||
/* indicator if the result is zero. */
|
/* indicator if the result is zero. */
|
||||||
Rational result = Sub(*m_memoryValue, m_currentVal, m_precision);
|
Rational result = (*m_memoryValue).Sub(m_currentVal, m_precision);
|
||||||
m_memoryValue = make_unique<Rational>(TruncateNumForIntMath(result));
|
m_memoryValue = make_unique<Rational>(TruncateNumForIntMath(result));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1054,9 +1054,9 @@ wstring CCalcEngine::GetStringForDisplay(Rational const& rat, uint32_t radix)
|
||||||
if ((radix == 10) && fMsb)
|
if ((radix == 10) && fMsb)
|
||||||
{
|
{
|
||||||
// If high bit is set, then get the decimal number in negative 2's compl form.
|
// If high bit is set, then get the decimal number in negative 2's compl form.
|
||||||
tempRat = Not(tempRat, true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
tempRat = tempRat.Not(true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
tempRat = Add(tempRat, 1, m_precision);
|
tempRat = tempRat.Add(1, m_precision);
|
||||||
tempRat = Negate(tempRat);
|
tempRat = tempRat.Negate();
|
||||||
}
|
}
|
||||||
|
|
||||||
result = tempRat.ToString(radix, m_nFE, m_precision);
|
result = tempRat.ToString(radix, m_nFE, m_precision);
|
||||||
|
|
|
@ -64,12 +64,12 @@ CalcEngine::Rational CCalcEngine::TruncateNumForIntMath(CalcEngine::Rational con
|
||||||
if (result.IsLess(Rational{}, m_precision))
|
if (result.IsLess(Rational{}, m_precision))
|
||||||
{
|
{
|
||||||
// if negative make positive by doing a twos complement
|
// if negative make positive by doing a twos complement
|
||||||
result = RationalMath::Negate(result);
|
result = result.Negate();
|
||||||
result = RationalMath::Sub(result, 1, m_precision);
|
result = result.Sub(1, m_precision);
|
||||||
result = RationalMath::Not(result, true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
result = result.Not(true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = RationalMath::And(result, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
result = result.And(m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
||||||
|
|
||||||
/* Return complement. */
|
/* Return complement. */
|
||||||
case IDC_COM:
|
case IDC_COM:
|
||||||
result = Not(rat, true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
result = rat.Not(true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Rotate Left with hi bit wrapped over to lo bit
|
// Rotate Left with hi bit wrapped over to lo bit
|
||||||
|
@ -76,12 +76,12 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
||||||
// Otherwise, we evaluate it as "X [op] (X * Y%)"
|
// Otherwise, we evaluate it as "X [op] (X * Y%)"
|
||||||
if (m_nOpCode == IDC_MUL || m_nOpCode == IDC_DIV)
|
if (m_nOpCode == IDC_MUL || m_nOpCode == IDC_DIV)
|
||||||
{
|
{
|
||||||
result = Div(rat, 100, m_precision);
|
result = rat.Div(100, m_precision);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = Div(m_lastVal, 100, m_precision);
|
result = m_lastVal.Div(100, m_precision);
|
||||||
result = Mul(rat, result, m_precision);
|
result = rat.Mul(result, m_precision);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -175,27 +175,27 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
||||||
|
|
||||||
Rational degreeRat = Integer(rat, m_radix, m_precision);
|
Rational degreeRat = Integer(rat, m_radix, m_precision);
|
||||||
|
|
||||||
Rational minuteRat = Sub(rat, degreeRat, m_precision);
|
Rational minuteRat = rat.Sub(degreeRat, m_precision);
|
||||||
minuteRat = Mul(minuteRat, shftRat, m_precision);
|
minuteRat = minuteRat.Mul(shftRat, m_precision);
|
||||||
|
|
||||||
Rational secondRat = minuteRat;
|
Rational secondRat = minuteRat;
|
||||||
|
|
||||||
minuteRat = Integer(minuteRat, m_radix, m_precision);
|
minuteRat = Integer(minuteRat, m_radix, m_precision);
|
||||||
|
|
||||||
secondRat = Sub(secondRat, minuteRat, m_precision);
|
secondRat = secondRat.Sub(minuteRat, m_precision);
|
||||||
secondRat = Mul(secondRat, shftRat, m_precision);
|
secondRat = secondRat.Mul(shftRat, m_precision);
|
||||||
|
|
||||||
//
|
//
|
||||||
// degreeRat == degrees, minuteRat == minutes, secondRat == seconds
|
// degreeRat == degrees, minuteRat == minutes, secondRat == seconds
|
||||||
//
|
//
|
||||||
|
|
||||||
shftRat = Rational{ m_bInv ? 60 : 100 };
|
shftRat = Rational{ m_bInv ? 60 : 100 };
|
||||||
secondRat = Div(secondRat, shftRat, m_precision);
|
secondRat = secondRat.Div(shftRat, m_precision);
|
||||||
|
|
||||||
minuteRat = Add(minuteRat, secondRat, m_precision);
|
minuteRat = minuteRat.Add(secondRat, m_precision);
|
||||||
minuteRat = Div(minuteRat, shftRat, m_precision);
|
minuteRat = minuteRat.Div(shftRat, m_precision);
|
||||||
|
|
||||||
result = Add(degreeRat, minuteRat, m_precision);
|
result = degreeRat.Add(minuteRat, m_precision);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,117 +45,6 @@ Rational RationalMath::Integer(Rational const& rat, uint32_t radix, int32_t prec
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational RationalMath::Add(Rational const& lhs, Rational const& rhs, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
addrat(&lhsRat, rhsRat, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Sub(Rational const& lhs, Rational const& rhs, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
subrat(&lhsRat, rhsRat, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Mul(Rational const& lhs, Rational const& rhs, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mulrat(&lhsRat, rhsRat, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Div(Rational const& lhs, Rational const& rhs, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
divrat(&lhsRat, rhsRat, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Mod(Rational const& lhs, Rational const& rhs)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
modrat(&lhsRat, rhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational RationalMath::Pow(Rational const& base, Rational const& pow, uint32_t radix, int32_t precision)
|
Rational RationalMath::Pow(Rational const& base, Rational const& pow, uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
PRAT baseRat = base.ToPRAT();
|
PRAT baseRat = base.ToPRAT();
|
||||||
|
@ -180,7 +69,7 @@ Rational RationalMath::Pow(Rational const& base, Rational const& pow, uint32_t r
|
||||||
}
|
}
|
||||||
Rational RationalMath::Root(Rational const& base, Rational const& root, uint32_t radix, int32_t precision)
|
Rational RationalMath::Root(Rational const& base, Rational const& root, uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
return Pow(base, Div(1, root, precision), radix, precision);
|
return Pow(base, Invert(root, precision), radix, precision);
|
||||||
}
|
}
|
||||||
Rational RationalMath::Fact(Rational const& rat, uint32_t radix, int32_t precision)
|
Rational RationalMath::Fact(Rational const& rat, uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
|
@ -242,61 +131,12 @@ Rational RationalMath::Log(Rational const& rat, int32_t precision)
|
||||||
}
|
}
|
||||||
Rational RationalMath::Log10(Rational const& rat, int32_t precision)
|
Rational RationalMath::Log10(Rational const& rat, int32_t precision)
|
||||||
{
|
{
|
||||||
return Div(Log(rat, precision), 10, precision);
|
return Log(rat, precision).Div(10, precision);
|
||||||
}
|
|
||||||
|
|
||||||
Rational RationalMath::Lsh(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
lshrat(&lhsRat, rhsRat, radix, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Rsh(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
rshrat(&lhsRat, rhsRat, radix, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational RationalMath::Invert(Rational const& rat, int32_t precision)
|
Rational RationalMath::Invert(Rational const& rat, int32_t precision)
|
||||||
{
|
{
|
||||||
return Div(1, rat, precision);
|
return Rational{ 1 }.Div(rat, precision);
|
||||||
}
|
|
||||||
Rational RationalMath::Negate(Rational const& rat)
|
|
||||||
{
|
|
||||||
return Rational{ Number{ -1 * rat.P().Sign(), rat.P().Exp(), rat.P().Mantissa() }, rat.Q() };
|
|
||||||
}
|
}
|
||||||
Rational RationalMath::Abs(Rational const& rat)
|
Rational RationalMath::Abs(Rational const& rat)
|
||||||
{
|
{
|
||||||
|
@ -534,85 +374,3 @@ Rational RationalMath::ATanh(Rational const& rat, int32_t precision)
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational RationalMath::Not(Rational const& rat, bool fIntegerMode, Rational const& chopNum, uint32_t radix, int32_t precision)
|
|
||||||
{
|
|
||||||
Rational result{};
|
|
||||||
|
|
||||||
if (radix == 10 && !fIntegerMode)
|
|
||||||
{
|
|
||||||
result = Integer(rat, radix, precision);
|
|
||||||
result = Add(result, 1, precision);
|
|
||||||
result = Negate(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = Xor(rat, chopNum, radix, precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::And(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
andrat(&lhsRat, rhsRat, radix, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Or(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
orrat(&lhsRat, rhsRat, radix, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Rational RationalMath::Xor(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision)
|
|
||||||
{
|
|
||||||
PRAT lhsRat = lhs.ToPRAT();
|
|
||||||
PRAT rhsRat = rhs.ToPRAT();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
xorrat(&lhsRat, rhsRat, radix, precision);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
}
|
|
||||||
catch (DWORD error)
|
|
||||||
{
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
destroyrat(rhsRat);
|
|
||||||
throw(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rational result{ lhsRat };
|
|
||||||
destroyrat(lhsRat);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,15 +18,15 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
switch (operation)
|
switch (operation)
|
||||||
{
|
{
|
||||||
case IDC_AND:
|
case IDC_AND:
|
||||||
result = And(result, rhs, m_radix, m_precision);
|
result = result.And(rhs, m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_OR:
|
case IDC_OR:
|
||||||
result = Or(result, rhs, m_radix, m_precision);
|
result = result.Or(rhs, m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_XOR:
|
case IDC_XOR:
|
||||||
result = Xor(result, rhs, m_radix, m_precision);
|
result = result.Xor(rhs, m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_RSHF:
|
case IDC_RSHF:
|
||||||
|
@ -40,17 +40,17 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
bool fMsb = (w64Bits >> (m_dwWordBitWidth - 1)) & 1;
|
bool fMsb = (w64Bits >> (m_dwWordBitWidth - 1)) & 1;
|
||||||
|
|
||||||
Rational holdVal = result;
|
Rational holdVal = result;
|
||||||
result = Rsh(rhs, holdVal, m_radix, m_precision);
|
result = rhs.Rsh(holdVal, m_radix, m_precision);
|
||||||
|
|
||||||
if (fMsb)
|
if (fMsb)
|
||||||
{
|
{
|
||||||
result = Integer(result, m_radix, m_precision);
|
result = Integer(result, m_radix, m_precision);
|
||||||
|
|
||||||
auto tempRat = Rsh(m_chopNumbers[m_numwidth], holdVal, m_radix, m_precision);
|
auto tempRat = m_chopNumbers[m_numwidth].Rsh(holdVal, m_radix, m_precision);
|
||||||
tempRat = Integer(tempRat, m_radix, m_precision);
|
tempRat = Integer(tempRat, m_radix, m_precision);
|
||||||
|
|
||||||
tempRat = Xor(tempRat, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
tempRat = tempRat.Xor(m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
result = Or(result, tempRat, m_radix, m_precision);
|
result = result.Or(tempRat, m_radix, m_precision);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -61,19 +61,19 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
throw CALC_E_NORESULT;
|
throw CALC_E_NORESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Lsh(rhs, result, m_radix, m_precision);
|
result = rhs.Lsh(result, m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_ADD:
|
case IDC_ADD:
|
||||||
result = Add(result, rhs, m_precision);
|
result = result.Add(rhs, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_SUB:
|
case IDC_SUB:
|
||||||
result = Sub(rhs, result, m_precision);
|
result = rhs.Sub(result, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_MUL:
|
case IDC_MUL:
|
||||||
result = Mul(result, rhs, m_precision);
|
result = result.Mul(rhs, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_DIV:
|
case IDC_DIV:
|
||||||
|
@ -90,8 +90,8 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
|
|
||||||
if (fMsb)
|
if (fMsb)
|
||||||
{
|
{
|
||||||
result = Not(rhs, true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
result = rhs.Not(true /* IntegerMode */, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
result = Add(result, 1, m_precision);
|
result = result.Add(1, m_precision);
|
||||||
|
|
||||||
iNumeratorSign = -1;
|
iNumeratorSign = -1;
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,8 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
|
|
||||||
if (fMsb)
|
if (fMsb)
|
||||||
{
|
{
|
||||||
temp = Not(temp, true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
temp = temp.Not(true /* IntegerMode */, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
temp = Add(temp, 1, m_precision);
|
temp = temp.Add(1, m_precision);
|
||||||
|
|
||||||
iDenominatorSign = -1;
|
iDenominatorSign = -1;
|
||||||
}
|
}
|
||||||
|
@ -111,17 +111,17 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
if (operation == IDC_DIV)
|
if (operation == IDC_DIV)
|
||||||
{
|
{
|
||||||
iFinalSign = iNumeratorSign * iDenominatorSign;
|
iFinalSign = iNumeratorSign * iDenominatorSign;
|
||||||
result = Div(result, temp, m_precision);
|
result = result.Div(temp, m_precision);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iFinalSign = iNumeratorSign;
|
iFinalSign = iNumeratorSign;
|
||||||
result = Mod(result, temp);
|
result = result.Mod(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_fIntegerMode && iFinalSign == -1)
|
if (m_fIntegerMode && iFinalSign == -1)
|
||||||
{
|
{
|
||||||
result = Negate(Integer(result, m_radix, m_precision));
|
result = Integer(result, m_radix, m_precision).Negate();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,10 +24,10 @@ void CCalcEngine::SetRadixTypeAndNumWidth(RADIX_TYPE radixtype, NUM_WIDTH numwid
|
||||||
if (fMsb)
|
if (fMsb)
|
||||||
{
|
{
|
||||||
// If high bit is set, then get the decimal number in -ve 2'scompl form.
|
// If high bit is set, then get the decimal number in -ve 2'scompl form.
|
||||||
auto tempResult = Not(m_currentVal, true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
auto tempResult = m_currentVal.Not(true /* IntegerMode */, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
||||||
tempResult = Add(tempResult, 1, m_precision);
|
tempResult = tempResult.Add(1, m_precision);
|
||||||
|
|
||||||
m_currentVal = Negate(tempResult);
|
m_currentVal = tempResult.Negate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ bool CCalcEngine::TryToggleBit(CalcEngine::Rational& rat, DWORD wbitno)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pow = Pow(2, static_cast<int32_t>(wbitno), m_radix, m_precision);
|
auto pow = Pow(2, static_cast<int32_t>(wbitno), m_radix, m_precision);
|
||||||
rat = Xor(result, pow, m_radix, m_precision);
|
rat = result.Xor(pow, m_radix, m_precision);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace CalcEngine
|
||||||
Rational() noexcept;
|
Rational() noexcept;
|
||||||
Rational(Number const& n) noexcept;
|
Rational(Number const& n) noexcept;
|
||||||
Rational(Number const& p, Number const& q) noexcept;
|
Rational(Number const& p, Number const& q) noexcept;
|
||||||
Rational(int32_t i) noexcept;
|
Rational(int32_t i);
|
||||||
Rational(uint32_t ui) noexcept;
|
Rational(uint32_t ui);
|
||||||
Rational(uint64_t ui, uint32_t radix, int32_t precision) noexcept;
|
Rational(uint64_t ui, uint32_t radix, int32_t precision);
|
||||||
|
|
||||||
explicit Rational(PRAT prat) noexcept;
|
explicit Rational(PRAT prat) noexcept;
|
||||||
PRAT ToPRAT() const;
|
PRAT ToPRAT() const;
|
||||||
|
@ -22,13 +22,28 @@ namespace CalcEngine
|
||||||
Number const& P() const;
|
Number const& P() const;
|
||||||
Number const& Q() const;
|
Number const& Q() const;
|
||||||
|
|
||||||
|
Rational Negate() const;
|
||||||
|
Rational Add(Rational const& rhs, int32_t precision) const;
|
||||||
|
Rational Sub(Rational const& rhs, int32_t precision) const;
|
||||||
|
Rational Mul(Rational const& rhs, int32_t precision) const;
|
||||||
|
Rational Div(Rational const& rhs, int32_t precision) const;
|
||||||
|
Rational Mod(Rational const& rhs) const;
|
||||||
|
|
||||||
|
Rational Lsh(Rational const& r, uint32_t radix, int32_t precision) const;
|
||||||
|
Rational Rsh(Rational const& r, uint32_t radix, int32_t precision) const;
|
||||||
|
|
||||||
|
Rational Not(bool isIntegerMode, Rational const& chopNum, uint32_t radix, int32_t precision) const;
|
||||||
|
Rational And(Rational const& r, uint32_t radix, int32_t precision) const;
|
||||||
|
Rational Or(Rational const& r, uint32_t radix, int32_t precision) const;
|
||||||
|
Rational Xor(Rational const& r, uint32_t radix, int32_t precision) const;
|
||||||
|
|
||||||
bool IsZero() const;
|
bool IsZero() const;
|
||||||
bool IsLess(Rational const& r, int32_t precision) const;
|
bool IsLess(Rational const& r, int32_t precision) const;
|
||||||
bool IsLessEq(Rational const& r, int32_t precision) const;
|
bool IsLessEq(Rational const& r, int32_t precision) const;
|
||||||
bool IsGreaterEq(Rational const& r, int32_t precision) const;
|
bool IsGreaterEq(Rational const& r, int32_t precision) const;
|
||||||
bool IsEq(Rational const& r, int32_t precision) const;
|
bool IsEq(Rational const& r, int32_t precision) const;
|
||||||
|
|
||||||
std::wstring ToString(uint32_t radix, NUMOBJ_FMT fmt, int32_t precision) const;
|
std::wstring ToString(uint32_t radix, NUMOBJ_FMT format, int32_t precision) const;
|
||||||
uint64_t ToUInt64_t(uint32_t radix, int32_t precision) const;
|
uint64_t ToUInt64_t(uint32_t radix, int32_t precision) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -8,12 +8,6 @@ namespace CalcEngine::RationalMath
|
||||||
Rational Frac(Rational const& rat, uint32_t radix, int32_t precision);
|
Rational Frac(Rational const& rat, uint32_t radix, int32_t precision);
|
||||||
Rational Integer(Rational const& rat, uint32_t radix, int32_t precision);
|
Rational Integer(Rational const& rat, uint32_t radix, int32_t precision);
|
||||||
|
|
||||||
Rational Add(Rational const& lhs, Rational const& rhs, int32_t precision);
|
|
||||||
Rational Sub(Rational const& lhs, Rational const& rhs, int32_t precision);
|
|
||||||
Rational Mul(Rational const& lhs, Rational const& rhs, int32_t precision);
|
|
||||||
Rational Div(Rational const& lhs, Rational const& rhs, int32_t precision);
|
|
||||||
Rational Mod(Rational const& lhs, Rational const& rhs);
|
|
||||||
|
|
||||||
Rational Pow(Rational const& base, Rational const& pow, uint32_t radix, int32_t precision);
|
Rational Pow(Rational const& base, Rational const& pow, uint32_t radix, int32_t precision);
|
||||||
Rational Root(Rational const& base, Rational const& root, uint32_t radix, int32_t precision);
|
Rational Root(Rational const& base, Rational const& root, uint32_t radix, int32_t precision);
|
||||||
Rational Fact(Rational const& rat, uint32_t radix, int32_t precision);
|
Rational Fact(Rational const& rat, uint32_t radix, int32_t precision);
|
||||||
|
@ -22,11 +16,7 @@ namespace CalcEngine::RationalMath
|
||||||
Rational Log(Rational const& rat, int32_t precision);
|
Rational Log(Rational const& rat, int32_t precision);
|
||||||
Rational Log10(Rational const& rat, int32_t precision);
|
Rational Log10(Rational const& rat, int32_t precision);
|
||||||
|
|
||||||
Rational Lsh(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision);
|
|
||||||
Rational Rsh(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision);
|
|
||||||
|
|
||||||
Rational Invert(Rational const& rat, int32_t precision);
|
Rational Invert(Rational const& rat, int32_t precision);
|
||||||
Rational Negate(Rational const& rat);
|
|
||||||
Rational Abs(Rational const& rat);
|
Rational Abs(Rational const& rat);
|
||||||
|
|
||||||
Rational Sin(Rational const& rat, ANGLE_TYPE angletype, uint32_t radix, int32_t precision);
|
Rational Sin(Rational const& rat, ANGLE_TYPE angletype, uint32_t radix, int32_t precision);
|
||||||
|
@ -42,9 +32,4 @@ namespace CalcEngine::RationalMath
|
||||||
Rational ASinh(Rational const& rat, uint32_t radix, int32_t precision);
|
Rational ASinh(Rational const& rat, uint32_t radix, int32_t precision);
|
||||||
Rational ACosh(Rational const& rat, uint32_t radix, int32_t precision);
|
Rational ACosh(Rational const& rat, uint32_t radix, int32_t precision);
|
||||||
Rational ATanh(Rational const& rat, int32_t precision);
|
Rational ATanh(Rational const& rat, int32_t precision);
|
||||||
|
|
||||||
Rational Not(Rational const& rat, bool fIntegerMode, Rational const& chopNum, uint32_t radix, int32_t precision);
|
|
||||||
Rational And(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision);
|
|
||||||
Rational Or(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision);
|
|
||||||
Rational Xor(Rational const& lhs, Rational const& rhs, uint32_t radix, int32_t precision);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue