🚨 fix warning

This commit is contained in:
Niels Lohmann
2024-11-08 23:13:25 +01:00
parent 9240ba4911
commit ddecb704e3
4 changed files with 56 additions and 12 deletions

View File

@@ -241,8 +241,8 @@ boundaries compute_boundaries(FloatType value)
const bool lower_boundary_is_closer = F == 0 && E > 1;
const diyfp m_plus = diyfp((2 * v.f) + 1, v.e - 1);
const diyfp m_minus = lower_boundary_is_closer
? diyfp(4 * v.f - 1, v.e - 2) // (B)
: diyfp(2 * v.f - 1, v.e - 1); // (A)
? diyfp((4 * v.f) - 1, v.e - 2) // (B)
: diyfp((2 * v.f) - 1, v.e - 1); // (A)
// Determine the normalized w+ = m+.
const diyfp w_plus = diyfp::normalize(m_plus);
@@ -472,7 +472,7 @@ inline cached_power get_cached_power_for_binary_exponent(int e)
JSON_ASSERT(e >= -1500);
JSON_ASSERT(e <= 1500);
const int f = kAlpha - e - 1;
const int k = (f * 78913) / (1 << 18) + static_cast<int>(f > 0);
const int k = ((f * 78913) / (1 << 18)) + static_cast<int>(f > 0);
const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
JSON_ASSERT(index >= 0);
@@ -950,15 +950,15 @@ inline char* append_exponent(char* buf, int e)
}
else if (k < 100)
{
*buf++ = static_cast<char>('0' + k / 10);
*buf++ = static_cast<char>('0' + (k / 10));
k %= 10;
*buf++ = static_cast<char>('0' + k);
}
else
{
*buf++ = static_cast<char>('0' + k / 100);
*buf++ = static_cast<char>('0' + (k / 100));
k %= 100;
*buf++ = static_cast<char>('0' + k / 10);
*buf++ = static_cast<char>('0' + (k / 10));
k %= 10;
*buf++ = static_cast<char>('0' + k);
}