mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-20 21:33:10 -07:00
Use implicit conversion of 0 to Rational
This commit is contained in:
parent
b5e4248620
commit
b1a2cc1d3c
2 changed files with 4 additions and 4 deletions
|
@ -61,7 +61,7 @@ CalcEngine::Rational CCalcEngine::TruncateNumForIntMath(CalcEngine::Rational con
|
||||||
|
|
||||||
// Can be converting a dec negative number to Hex/Oct/Bin rep. Use 2's complement form
|
// Can be converting a dec negative number to Hex/Oct/Bin rep. Use 2's complement form
|
||||||
// Check the range.
|
// Check the range.
|
||||||
if (result.IsLess(Rational{}, m_precision))
|
if (result.IsLess(0, m_precision))
|
||||||
{
|
{
|
||||||
// if negative make positive by doing a twos complement
|
// if negative make positive by doing a twos complement
|
||||||
result = result.Negate();
|
result = result.Negate();
|
||||||
|
@ -146,7 +146,7 @@ int CCalcEngine::IsNumberInvalid(const wstring& numberString, int iMaxExp, int i
|
||||||
// in case there's an exponent:
|
// in case there's an exponent:
|
||||||
// its optionally followed by a + or -
|
// its optionally followed by a + or -
|
||||||
// which is followed by zero or more digits
|
// which is followed by zero or more digits
|
||||||
wregex rx(wstring{ c_decPreSepStr } +m_decimalSeparator + wstring{ c_decPostSepStr });
|
wregex rx(wstring{ c_decPreSepStr } + m_decimalSeparator + wstring{ c_decPostSepStr });
|
||||||
wsmatch matches;
|
wsmatch matches;
|
||||||
if (regex_match(numberString, matches, rx))
|
if (regex_match(numberString, matches, rx))
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
||||||
|
|
||||||
/* Return complement. */
|
/* Return complement. */
|
||||||
case IDC_COM:
|
case IDC_COM:
|
||||||
result = rat.Not(true, m_chopNumbers[m_numwidth], m_radix, m_precision);
|
result = rat.Not(m_fIntegerMode, 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
|
||||||
|
@ -136,7 +136,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
||||||
result = Pow(rat, 2, m_radix, m_precision);
|
result = Pow(rat, 2, m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_SQRT: /* Sqrt only in Std mode */
|
case IDC_SQRT: /* Square Root */
|
||||||
result = Root(rat, 2, m_radix, m_precision);
|
result = Root(rat, 2, m_radix, m_precision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue