15 #ifndef RAPIDJSON_IEEE754_
16 #define RAPIDJSON_IEEE754_
18 #include "../rapidjson.h"
29 double Value()
const {
return d_; }
37 bool Sign()
const {
return (u_ & kSignMask) != 0; }
39 int Exponent()
const {
return static_cast<int>(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); }
41 bool IsNan()
const {
return (u_ & kExponentMask) == kExponentMask && Significand() != 0; }
42 bool IsInf()
const {
return (u_ & kExponentMask) == kExponentMask && Significand() == 0; }
43 bool IsNanOrInf()
const {
return (u_ & kExponentMask) == kExponentMask; }
44 bool IsNormal()
const {
return (u_ & kExponentMask) != 0 || Significand() == 0; }
45 bool IsZero()
const {
return (u_ & (kExponentMask | kSignificandMask)) == 0; }
48 int IntegerExponent()
const {
return (IsNormal() ? Exponent() : kDenormalExponent) - kSignificandSize; }
49 uint64_t ToBias()
const {
return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask; }
54 else if (order <= -1074)
61 static const int kSignificandSize = 52;
62 static const int kExponentBias = 0x3FF;
63 static const int kDenormalExponent = 1 - kExponentBias;
double NextPositiveDouble() const
static int EffectiveSignificandSize(int order)
int IntegerExponent() const
uint64_t IntegerSignificand() const
uint64_t Significand() const
uint64_t Uint64Value() const
#define RAPIDJSON_ASSERT(x)
Assertion.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.