mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-20 13:23:13 -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
|
||||
// Check the range.
|
||||
if (result.IsLess(Rational{}, m_precision))
|
||||
if (result.IsLess(0, m_precision))
|
||||
{
|
||||
// if negative make positive by doing a twos complement
|
||||
result = result.Negate();
|
||||
|
@ -146,7 +146,7 @@ int CCalcEngine::IsNumberInvalid(const wstring& numberString, int iMaxExp, int i
|
|||
// in case there's an exponent:
|
||||
// its optionally followed by a + or -
|
||||
// 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;
|
||||
if (regex_match(numberString, matches, rx))
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
|
||||
/* Return complement. */
|
||||
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;
|
||||
|
||||
// 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);
|
||||
break;
|
||||
|
||||
case IDC_SQRT: /* Sqrt only in Std mode */
|
||||
case IDC_SQRT: /* Square Root */
|
||||
result = Root(rat, 2, m_radix, m_precision);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue