Fix typo (and thus bug)

This commit is contained in:
Junekey Jeon 2020-09-18 11:21:07 -07:00 committed by Victor Zverovich
parent 0c8ffe9b0f
commit 6f81ea151a

View File

@ -2081,7 +2081,7 @@ template <> struct cache_accessor<double> {
"k is out of range"); "k is out of range");
#if FMT_USE_FULL_CACHE_DRAGONBOX #if FMT_USE_FULL_CACHE_DRAGONBOX
return data::dragonbox_pow10_significands_128[k - float_info<float>::min_k]; return data::dragonbox_pow10_significands_128[k - float_info<double>::min_k];
#else #else
static const int compression_ratio = 27; static const int compression_ratio = 27;
@ -2131,50 +2131,50 @@ template <> struct cache_accessor<double> {
recovered_cache = {recovered_cache.high(), recovered_cache.low() + error}; recovered_cache = {recovered_cache.high(), recovered_cache.low() + error};
return recovered_cache; return recovered_cache;
}
#endif #endif
} }
}
static carrier_uint static carrier_uint compute_mul(carrier_uint u,
compute_mul(carrier_uint u, const cache_entry_type& cache) FMT_NOEXCEPT { const cache_entry_type& cache) FMT_NOEXCEPT {
return umul192_upper64(u, cache); return umul192_upper64(u, cache);
} }
static uint32_t compute_delta(cache_entry_type const& cache, static uint32_t compute_delta(cache_entry_type const& cache,
int beta_minus_1) FMT_NOEXCEPT { int beta_minus_1) FMT_NOEXCEPT {
return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta_minus_1)); return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta_minus_1));
} }
static bool compute_mul_parity(carrier_uint two_f, static bool compute_mul_parity(carrier_uint two_f,
const cache_entry_type& cache, const cache_entry_type& cache,
int beta_minus_1) FMT_NOEXCEPT { int beta_minus_1) FMT_NOEXCEPT {
FMT_ASSERT(beta_minus_1 >= 1, ""); FMT_ASSERT(beta_minus_1 >= 1, "");
FMT_ASSERT(beta_minus_1 < 64, ""); FMT_ASSERT(beta_minus_1 < 64, "");
return ((umul192_middle64(two_f, cache) >> (64 - beta_minus_1)) & 1) != 0; return ((umul192_middle64(two_f, cache) >> (64 - beta_minus_1)) & 1) != 0;
} }
static carrier_uint compute_left_endpoint_for_shorter_interval_case( static carrier_uint compute_left_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT {
return (cache.high() - return (cache.high() -
(cache.high() >> (float_info<double>::significand_bits + 2))) >> (cache.high() >> (float_info<double>::significand_bits + 2))) >>
(64 - float_info<double>::significand_bits - 1 - beta_minus_1); (64 - float_info<double>::significand_bits - 1 - beta_minus_1);
} }
static carrier_uint compute_right_endpoint_for_shorter_interval_case( static carrier_uint compute_right_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT {
return (cache.high() + return (cache.high() +
(cache.high() >> (float_info<double>::significand_bits + 1))) >> (cache.high() >> (float_info<double>::significand_bits + 1))) >>
(64 - float_info<double>::significand_bits - 1 - beta_minus_1); (64 - float_info<double>::significand_bits - 1 - beta_minus_1);
} }
static carrier_uint compute_round_up_for_shorter_interval_case( static carrier_uint compute_round_up_for_shorter_interval_case(
const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT {
return ((cache.high() >> return ((cache.high() >>
(64 - float_info<double>::significand_bits - 2 - beta_minus_1)) + (64 - float_info<double>::significand_bits - 2 - beta_minus_1)) +
1) / 1) /
2; 2;
} }
}; // namespace dragonbox }; // namespace dragonbox
// Various integer checks // Various integer checks
@ -2530,7 +2530,7 @@ small_divisor_case_label:
} }
return ret_value; return ret_value;
} }
} // namespace detail } // namespace dragonbox
// Formats value using a variation of the Fixed-Precision Positive // Formats value using a variation of the Fixed-Precision Positive
// Floating-Point Printout ((FPP)^2) algorithm by Steele & White: // Floating-Point Printout ((FPP)^2) algorithm by Steele & White: