For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c satisfies (Definition 3.2 from [1])
13022 constexpr
int kCachedPowersMinDecExp = -300;
13023 constexpr
int kCachedPowersDecStep = 8;
13025 static constexpr std::array<cached_power, 79> kCachedPowers =
13028 { 0xAB70FE17C79AC6CA, -1060, -300 },
13029 { 0xFF77B1FCBEBCDC4F, -1034, -292 },
13030 { 0xBE5691EF416BD60C, -1007, -284 },
13031 { 0x8DD01FAD907FFC3C, -980, -276 },
13032 { 0xD3515C2831559A83, -954, -268 },
13033 { 0x9D71AC8FADA6C9B5, -927, -260 },
13034 { 0xEA9C227723EE8BCB, -901, -252 },
13035 { 0xAECC49914078536D, -874, -244 },
13036 { 0x823C12795DB6CE57, -847, -236 },
13037 { 0xC21094364DFB5637, -821, -228 },
13038 { 0x9096EA6F3848984F, -794, -220 },
13039 { 0xD77485CB25823AC7, -768, -212 },
13040 { 0xA086CFCD97BF97F4, -741, -204 },
13041 { 0xEF340A98172AACE5, -715, -196 },
13042 { 0xB23867FB2A35B28E, -688, -188 },
13043 { 0x84C8D4DFD2C63F3B, -661, -180 },
13044 { 0xC5DD44271AD3CDBA, -635, -172 },
13045 { 0x936B9FCEBB25C996, -608, -164 },
13046 { 0xDBAC6C247D62A584, -582, -156 },
13047 { 0xA3AB66580D5FDAF6, -555, -148 },
13048 { 0xF3E2F893DEC3F126, -529, -140 },
13049 { 0xB5B5ADA8AAFF80B8, -502, -132 },
13050 { 0x87625F056C7C4A8B, -475, -124 },
13051 { 0xC9BCFF6034C13053, -449, -116 },
13052 { 0x964E858C91BA2655, -422, -108 },
13053 { 0xDFF9772470297EBD, -396, -100 },
13054 { 0xA6DFBD9FB8E5B88F, -369, -92 },
13055 { 0xF8A95FCF88747D94, -343, -84 },
13056 { 0xB94470938FA89BCF, -316, -76 },
13057 { 0x8A08F0F8BF0F156B, -289, -68 },
13058 { 0xCDB02555653131B6, -263, -60 },
13059 { 0x993FE2C6D07B7FAC, -236, -52 },
13060 { 0xE45C10C42A2B3B06, -210, -44 },
13061 { 0xAA242499697392D3, -183, -36 },
13062 { 0xFD87B5F28300CA0E, -157, -28 },
13063 { 0xBCE5086492111AEB, -130, -20 },
13064 { 0x8CBCCC096F5088CC, -103, -12 },
13065 { 0xD1B71758E219652C, -77, -4 },
13066 { 0x9C40000000000000, -50, 4 },
13067 { 0xE8D4A51000000000, -24, 12 },
13068 { 0xAD78EBC5AC620000, 3, 20 },
13069 { 0x813F3978F8940984, 30, 28 },
13070 { 0xC097CE7BC90715B3, 56, 36 },
13071 { 0x8F7E32CE7BEA5C70, 83, 44 },
13072 { 0xD5D238A4ABE98068, 109, 52 },
13073 { 0x9F4F2726179A2245, 136, 60 },
13074 { 0xED63A231D4C4FB27, 162, 68 },
13075 { 0xB0DE65388CC8ADA8, 189, 76 },
13076 { 0x83C7088E1AAB65DB, 216, 84 },
13077 { 0xC45D1DF942711D9A, 242, 92 },
13078 { 0x924D692CA61BE758, 269, 100 },
13079 { 0xDA01EE641A708DEA, 295, 108 },
13080 { 0xA26DA3999AEF774A, 322, 116 },
13081 { 0xF209787BB47D6B85, 348, 124 },
13082 { 0xB454E4A179DD1877, 375, 132 },
13083 { 0x865B86925B9BC5C2, 402, 140 },
13084 { 0xC83553C5C8965D3D, 428, 148 },
13085 { 0x952AB45CFA97A0B3, 455, 156 },
13086 { 0xDE469FBD99A05FE3, 481, 164 },
13087 { 0xA59BC234DB398C25, 508, 172 },
13088 { 0xF6C69A72A3989F5C, 534, 180 },
13089 { 0xB7DCBF5354E9BECE, 561, 188 },
13090 { 0x88FCF317F22241E2, 588, 196 },
13091 { 0xCC20CE9BD35C78A5, 614, 204 },
13092 { 0x98165AF37B2153DF, 641, 212 },
13093 { 0xE2A0B5DC971F303A, 667, 220 },
13094 { 0xA8D9D1535CE3B396, 694, 228 },
13095 { 0xFB9B7CD9A4A7443C, 720, 236 },
13096 { 0xBB764C4CA7A44410, 747, 244 },
13097 { 0x8BAB8EEFB6409C1A, 774, 252 },
13098 { 0xD01FEF10A657842C, 800, 260 },
13099 { 0x9B10A4E5E9913129, 827, 268 },
13100 { 0xE7109BFBA19C0C9D, 853, 276 },
13101 { 0xAC2820D9623BF429, 880, 284 },
13102 { 0x80444B5E7AA7CF85, 907, 292 },
13103 { 0xBF21E44003ACDD2D, 933, 300 },
13104 { 0x8E679C2F5E44FF8F, 960, 308 },
13105 { 0xD433179D9C8CB841, 986, 316 },
13106 { 0x9E19DB92B4E31BA9, 1013, 324 },
13114 assert(
e >= -1500);
13116 const int f =
kAlpha -
e - 1;
13117 const int k = (f * 78913) / (1 << 18) +
static_cast<int>(f > 0);
13119 const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
13120 assert(index >= 0);
13121 assert(static_cast<std::size_t>(index) < kCachedPowers.size());
13123 const cached_power cached = kCachedPowers[
static_cast<std::size_t
>(index)];
13124 assert(
kAlpha <= cached.e + e + 64);
13125 assert(
kGamma >= cached.e + e + 64);