| 204 | } |
| 205 | |
| 206 | inline double StrtodBigInteger(double approx, const char* decimals, size_t length, size_t decimalPosition, int exp) { |
| 207 | const BigInteger dInt(decimals, length); |
| 208 | const int dExp = static_cast<int>(decimalPosition) - static_cast<int>(length) + exp; |
| 209 | Double a(approx); |
| 210 | int cmp = CheckWithinHalfULP(a.Value(), dInt, dExp); |
| 211 | if (cmp < 0) |
| 212 | return a.Value(); // within half ULP |
| 213 | else if (cmp == 0) { |
| 214 | // Round towards even |
| 215 | if (a.Significand() & 1) |
| 216 | return a.NextPositiveDouble(); |
| 217 | else |
| 218 | return a.Value(); |
| 219 | } |
| 220 | else // adjustment |
| 221 | return a.NextPositiveDouble(); |
| 222 | } |
| 223 | |
| 224 | inline double StrtodFullPrecision(double d, int p, const char* decimals, size_t length, size_t decimalPosition, int exp) { |
| 225 | RAPIDJSON_ASSERT(d >= 0.0); |
no test coverage detected