We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7acbb87 commit cb009f3Copy full SHA for cb009f3
include/rapidjson/internal/diyfp.h
@@ -20,6 +20,7 @@
20
#define RAPIDJSON_DIYFP_H_
21
22
#include "../rapidjson.h"
23
+#include <limits>
24
25
#if defined(_MSC_VER) && defined(_M_AMD64) && !defined(__INTEL_COMPILER)
26
#include <intrin.h>
@@ -146,7 +147,10 @@ struct DiyFp {
146
147
// Underflow.
148
return 0.0;
149
}
- RAPIDJSON_ASSERT(e < kDpMaxExponent);
150
+ if (e >= kDpMaxExponent) {
151
+ // Overflow.
152
+ return std::numeric_limits<double>::infinity();
153
+ }
154
const uint64_t be = (e == kDpDenormalExponent && (f & kDpHiddenBit) == 0) ? 0 :
155
static_cast<uint64_t>(e + kDpExponentBias);
156
u.u64 = (f & kDpSignificandMask) | (be << kDpSignificandSize);
0 commit comments