mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Finish
This commit is contained in:
parent
06acd7d544
commit
e5172e9839
1 changed files with 7 additions and 6 deletions
|
@ -610,7 +610,7 @@ wchar_t NormalizeCharDigit(wchar_t c, uint32_t radix)
|
||||||
PNUMBER StringToNumber(wstring_view numberString, uint32_t radix, int32_t precision)
|
PNUMBER StringToNumber(wstring_view numberString, uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
int32_t expSign = 1L; // expSign is exponent sign ( +/- 1 )
|
int32_t expSign = 1L; // expSign is exponent sign ( +/- 1 )
|
||||||
uint32_t expValue = 0L; // expValue is exponent mantissa, should be unsigned
|
uint32_t expValue = 0UL; // expValue is exponent mantissa, should be unsigned
|
||||||
|
|
||||||
PNUMBER pnumret = nullptr;
|
PNUMBER pnumret = nullptr;
|
||||||
createnum(pnumret, static_cast<uint32_t>(numberString.length()));
|
createnum(pnumret, static_cast<uint32_t>(numberString.length()));
|
||||||
|
@ -723,7 +723,7 @@ PNUMBER StringToNumber(wstring_view numberString, uint32_t radix, int32_t precis
|
||||||
pnumret->exp--;
|
pnumret->exp--;
|
||||||
}
|
}
|
||||||
|
|
||||||
pnumret->exp += expSign * expValue;
|
pnumret->exp += expSign * static_cast<int32_t>(expValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have a number, clear our result.
|
// If we don't have a number, clear our result.
|
||||||
|
@ -1000,7 +1000,7 @@ int32_t numtoi32(_In_ PNUMBER pnum, uint32_t radix)
|
||||||
lret += *(pmant--);
|
lret += *(pmant--);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (expt-- > 0)
|
for (; expt > 0; expt--)
|
||||||
{
|
{
|
||||||
lret *= radix;
|
lret *= radix;
|
||||||
}
|
}
|
||||||
|
@ -1229,11 +1229,12 @@ wstring NumberToString(_Inout_ PNUMBER& pnum, NumberFormat format, uint32_t radi
|
||||||
while (exponent > 0)
|
while (exponent > 0)
|
||||||
{
|
{
|
||||||
result += L'0';
|
result += L'0';
|
||||||
exponent--;
|
|
||||||
// Be more regular in using a decimal point.
|
// Be more regular in using a decimal point.
|
||||||
if (exponent == 0)
|
if (--exponent == 0)
|
||||||
{
|
{
|
||||||
result += g_decimalSeparator;
|
result += g_decimalSeparator;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue