| 109 | } |
| 110 | |
| 111 | inline 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 |
| 129 | inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosition, int exp, double* result) { |
no test coverage detected