mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Fix some functions that require reference semantics instead of value semantics
This commit is contained in:
parent
89e454a65b
commit
97fa6aa387
3 changed files with 9 additions and 9 deletions
|
@ -427,21 +427,21 @@ void _divnum( NUMBER *pa, const NUMBER &b, uint32_t radix, int32_t precision)
|
||||||
while (cdigits++ < thismax && !zernum(rem))
|
while (cdigits++ < thismax && !zernum(rem))
|
||||||
{
|
{
|
||||||
digit = radix - 1;
|
digit = radix - 1;
|
||||||
NUMBER multiple;
|
NUMBER* multiple;
|
||||||
for (const auto& num : numberList)
|
for (auto& num : numberList)
|
||||||
{
|
{
|
||||||
if (!lessnum(rem, num) || !--digit)
|
if (!lessnum(rem, num) || !--digit)
|
||||||
{
|
{
|
||||||
multiple = num;
|
multiple = #
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (digit)
|
if (digit)
|
||||||
{
|
{
|
||||||
multiple.sign *= -1;
|
multiple->sign *= -1;
|
||||||
addnum(&rem, multiple, radix);
|
addnum(&rem, *multiple, radix);
|
||||||
multiple.sign *= -1;
|
multiple->sign *= -1;
|
||||||
}
|
}
|
||||||
rem.exp++;
|
rem.exp++;
|
||||||
*ptrc-- = (MANTTYPE)digit;
|
*ptrc-- = (MANTTYPE)digit;
|
||||||
|
|
|
@ -61,7 +61,7 @@ typedef struct _number
|
||||||
// radix being used.
|
// radix being used.
|
||||||
int32_t exp; // The offset of digits from the radix point
|
int32_t exp; // The offset of digits from the radix point
|
||||||
// (decimal point in radix 10)
|
// (decimal point in radix 10)
|
||||||
std::vector<MANTTYPE> mant = {0};
|
std::vector<MANTTYPE> mant;
|
||||||
} NUMBER;
|
} NUMBER;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -657,8 +657,8 @@ void trimit( PRAT *px, int32_t precision)
|
||||||
if ( !g_ftrueinfinite )
|
if ( !g_ftrueinfinite )
|
||||||
{
|
{
|
||||||
int32_t trim;
|
int32_t trim;
|
||||||
NUMBER pp=(*px)->pp;
|
NUMBER& pp=(*px)->pp;
|
||||||
NUMBER pq=(*px)->pq;
|
NUMBER& pq=(*px)->pq;
|
||||||
trim = g_ratio * (min((pp.cdigit+pp.exp),(pq.cdigit+pq.exp))-1) - precision;
|
trim = g_ratio * (min((pp.cdigit+pp.exp),(pq.cdigit+pq.exp))-1) - precision;
|
||||||
if ( trim > g_ratio )
|
if ( trim > g_ratio )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue