MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / parseFloatingFast

Method parseFloatingFast

include/sonic/dom/parser.h:167–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165 }
166
167 sonic_force_inline bool parseFloatingFast(double &d, int exp10,
168 uint64_t man) const {
169 d = (double)man;
170 // if man is small, but exp is large, also can parse excactly
171 if (exp10 > 0) {
172 if (exp10 > 22) {
173 d *= internal::kPow10Tab[exp10 - 22];
174 if (d > 1e15 || d < -1e15) {
175 // the exponent is tooo large
176 return false;
177 }
178 d *= internal::kPow10Tab[22];
179 return true;
180 }
181 d *= internal::kPow10Tab[exp10];
182 return true;
183 } else {
184 d /= internal::kPow10Tab[-exp10];
185 return true;
186 }
187 return false;
188 }
189
190 SonicError parseFloatEiselLemire64(double &dbl, int exp10, uint64_t man,
191 int sgn, bool trunc, const char *s) const {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected