28 {
29 static const int kSignificandSize = 52;
30 static const int kExponentBias = 0x3FF;
34
35
36
37
38 union {
41 }u;
42 u.u = 0x465a72e467d88 | ((
static_cast<uint64_t>(-149 + kExponentBias)) << kSignificandSize);
43 const double b = u.d;
44 const uint64_t bInt = (u.u & kSignificandMask) | kHiddenBit;
45 const int bExp = static_cast<int>(((u.u & kExponentMask) >> kSignificandSize) - kExponentBias - kSignificandSize);
49
50
51 const char dInt[] = "17864";
52 const int dExp = -49;
53
54
55 const int hExp = bExp - 1;
57
58 int dS_Exp2 = 0;
59 int dS_Exp5 = 0;
60 int bS_Exp2 = 0;
61 int bS_Exp5 = 0;
62 int hS_Exp2 = 0;
63 int hS_Exp5 = 0;
64
65
66 if (dExp >= 0) {
67 dS_Exp2 += dExp;
68 dS_Exp5 += dExp;
69 }
70 else {
71 bS_Exp2 -= dExp;
72 bS_Exp5 -= dExp;
73 hS_Exp2 -= dExp;
74 hS_Exp5 -= dExp;
75 }
76
77
78 if (bExp >= 0)
79 bS_Exp2 += bExp;
80 else {
81 dS_Exp2 -= bExp;
82 hS_Exp2 -= bExp;
83 }
84
85
86 if (hExp >= 0)
87 hS_Exp2 += hExp;
88 else {
89 dS_Exp2 -= hExp;
90 bS_Exp2 -= hExp;
91 }
92
93
94 int common_Exp2 = (std::min)(dS_Exp2, (std::min)(bS_Exp2, hS_Exp2));
95 dS_Exp2 -= common_Exp2;
96 bS_Exp2 -= common_Exp2;
97 hS_Exp2 -= common_Exp2;
98
105
107 dS.MultiplyPow5(static_cast<unsigned>(dS_Exp5)) <<= static_cast<size_t>(dS_Exp2);
108
109 BigInteger bS(bInt);
110 bS.MultiplyPow5(static_cast<unsigned>(bS_Exp5)) <<= static_cast<size_t>(bS_Exp2);
111
112 BigInteger hS(1);
113 hS.MultiplyPow5(static_cast<unsigned>(hS_Exp5)) <<= static_cast<size_t>(hS_Exp2);
114
118
120
121 BigInteger delta(0);
126
128}
#define EXPECT_EQ(val1, val2)
#define EXPECT_DOUBLE_EQ(val1, val2)
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
unsigned __int64 uint64_t
#define BIGINTEGER_LITERAL(s)