forked from fmtlib/fmt
Recover log10_2_significand
This commit is contained in:
committed by
Victor Zverovich
parent
10642e6082
commit
7dbe3dcded
@ -327,7 +327,8 @@ FMT_CONSTEXPR inline fp operator*(fp x, fp y) {
|
|||||||
FMT_CONSTEXPR inline fp get_cached_power(int min_exponent,
|
FMT_CONSTEXPR inline fp get_cached_power(int min_exponent,
|
||||||
int& pow10_exponent) {
|
int& pow10_exponent) {
|
||||||
const int shift = 32;
|
const int shift = 32;
|
||||||
const auto significand = static_cast<int64_t>(log10_2_significand);
|
// log10(2) = 0x0.4d104d427de7fbcc...
|
||||||
|
const auto significand = static_cast<int64_t>(0x4d104d427de7fbcc);
|
||||||
int index = static_cast<int>(
|
int index = static_cast<int>(
|
||||||
((min_exponent + fp::num_significand_bits - 1) * (significand >> shift) +
|
((min_exponent + fp::num_significand_bits - 1) * (significand >> shift) +
|
||||||
((int64_t(1) << shift) - 1)) // ceil
|
((int64_t(1) << shift) - 1)) // ceil
|
||||||
|
Reference in New Issue
Block a user