diff options
Diffstat (limited to 'xmrstak/rapidjson/internal/strtod.h')
-rw-r--r-- | xmrstak/rapidjson/internal/strtod.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xmrstak/rapidjson/internal/strtod.h b/xmrstak/rapidjson/internal/strtod.h index 289c413..8b010eb 100644 --- a/xmrstak/rapidjson/internal/strtod.h +++ b/xmrstak/rapidjson/internal/strtod.h @@ -1,5 +1,5 @@ // Tencent is pleased to support the open source community by making RapidJSON available. -// +// // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. // // Licensed under the MIT License (the "License"); you may not use this file except @@ -7,9 +7,9 @@ // // http://opensource.org/licenses/MIT // -// Unless required by applicable law or agreed to in writing, software distributed -// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. #ifndef RAPIDJSON_STRTOD_ @@ -128,14 +128,14 @@ inline bool StrtodFast(double d, int p, double* result) { // Compute an approximation and see if it is within 1/2 ULP inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosition, int exp, double* result) { uint64_t significand = 0; - size_t i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 + size_t i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 for (; i < length; i++) { if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > '5')) break; significand = significand * 10u + static_cast<unsigned>(decimals[i] - '0'); } - + if (i < length && decimals[i] >= '5') // Rounding significand++; @@ -182,7 +182,7 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit if (precisionSize + kUlpShift >= 64) { unsigned scaleExp = (precisionSize + kUlpShift) - 63; v.f >>= scaleExp; - v.e += scaleExp; + v.e += scaleExp; error = (error >> scaleExp) + 1 + static_cast<int>(kUlp); precisionSize -= scaleExp; } |