diff --git a/src/CalcManager/Ratpack/support.cpp b/src/CalcManager/Ratpack/support.cpp index ef9e4106..36077c7e 100644 --- a/src/CalcManager/Ratpack/support.cpp +++ b/src/CalcManager/Ratpack/support.cpp @@ -25,7 +25,7 @@ using namespace std; -void _readconstants(void); +void _readconstants(); #if defined(GEN_CONST) static int cbitsofprecision = 0; @@ -136,13 +136,14 @@ void ChangeConstants(uint32_t radix, int32_t precision) // in the internal BASEX radix, this is important for length calculations // in translating from radix to BASEX and back. - uint64_t limit = static_cast(BASEX) / static_cast(radix); + const uint32_t limit = BASEX / radix; g_ratio = 0; for (uint32_t digit = 1; digit < limit; digit *= radix) { g_ratio++; } - g_ratio += !g_ratio; + if (g_ratio == 0) + g_ratio = 1; // g_ratio is always at least 1 destroyrat(rat_nRadix); rat_nRadix = i32torat(radix);