@@ -58,7 +58,11 @@ inline int CountDecimalDigit32(uint32_t n) {
58
58
}
59
59
60
60
inline void DigitGen (const DiyFp& W, const DiyFp& Mp, uint64_t delta, char * buffer, int * len, int * K) {
61
- static const uint32_t kPow10 [] = { 1 , 10 , 100 , 1000 , 10000 , 100000 , 1000000 , 10000000 , 100000000 , 1000000000 };
61
+ static const uint64_t kPow10 [] = { 1U , 10U , 100U , 1000U , 10000U , 100000U , 1000000U , 10000000U , 100000000U ,
62
+ 1000000000U , 10000000000U , 100000000000U , 1000000000000U ,
63
+ 10000000000000U , 100000000000000U , 1000000000000000U ,
64
+ 10000000000000000U , 100000000000000000U , 1000000000000000000U ,
65
+ 10000000000000000000U };
62
66
const DiyFp one (uint64_t (1 ) << -Mp.e , Mp.e );
63
67
const DiyFp wp_w = Mp - W;
64
68
uint32_t p1 = static_cast <uint32_t >(Mp.f >> -one.e );
@@ -86,7 +90,7 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buff
86
90
uint64_t tmp = (static_cast <uint64_t >(p1) << -one.e ) + p2;
87
91
if (tmp <= delta) {
88
92
*K += kappa;
89
- GrisuRound (buffer, *len, delta, tmp, static_cast < uint64_t >( kPow10 [kappa]) << -one.e , wp_w.f );
93
+ GrisuRound (buffer, *len, delta, tmp, kPow10 [kappa] << -one.e , wp_w.f );
90
94
return ;
91
95
}
92
96
}
@@ -103,7 +107,7 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buff
103
107
if (p2 < delta) {
104
108
*K += kappa;
105
109
int index = -kappa;
106
- GrisuRound (buffer, *len, delta, p2, one.f , wp_w.f * (index < 9 ? kPow10 [index] : 0 ));
110
+ GrisuRound (buffer, *len, delta, p2, one.f , wp_w.f * (index < 20 ? kPow10 [index] : 0 ));
107
111
return ;
108
112
}
109
113
}
0 commit comments