mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-24 06:55:19 -07:00
Alternate version
This commit is contained in:
parent
6a09b56363
commit
16b29fa976
1 changed files with 1 additions and 8 deletions
|
@ -136,14 +136,7 @@ void ChangeConstants(uint32_t radix, int32_t precision)
|
||||||
// in the internal BASEX radix, this is important for length calculations
|
// in the internal BASEX radix, this is important for length calculations
|
||||||
// in translating from radix to BASEX and back.
|
// in translating from radix to BASEX and back.
|
||||||
|
|
||||||
const uint32_t limit = BASEX / radix;
|
g_ratio = static_cast<int32_t>(ceil(log2(BASEX) / log2(radix))) - 1;
|
||||||
g_ratio = 0;
|
|
||||||
for (uint32_t digit = 1; digit < limit; digit *= radix)
|
|
||||||
{
|
|
||||||
g_ratio++;
|
|
||||||
}
|
|
||||||
if (g_ratio == 0)
|
|
||||||
g_ratio = 1; // g_ratio is always at least 1
|
|
||||||
|
|
||||||
destroyrat(rat_nRadix);
|
destroyrat(rat_nRadix);
|
||||||
rat_nRadix = i32torat(radix);
|
rat_nRadix = i32torat(radix);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue