MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / StrtodFast

Function StrtodFast

rapidjson/internal/strtod.h:111–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111inline bool StrtodFast(double d, int p, double* result) {
112 // Use fast path for string-to-double conversion if possible
113 // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion/
114 if (p > 22 && p < 22 + 16) {
115 // Fast Path Cases In Disguise
116 d *= internal::Pow10(p - 22);
117 p = 22;
118 }
119
120 if (p >= -22 && p <= 22 && d <= 9007199254740991.0) { // 2^53 - 1
121 *result = FastPath(d, p);
122 return true;
123 }
124 else
125 return false;
126}
127
128// Compute an approximation and see if it is within 1/2 ULP
129inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosition, int exp, double* result) {

Callers 1

StrtodFullPrecisionFunction · 0.85

Calls 2

Pow10Function · 0.85
FastPathFunction · 0.85

Tested by

no test coverage detected