27 Double(
double d) : d_(d) {}
30 double Value()
const {
return d_; }
31 uint64_t Uint64Value()
const {
return u_; }
33 double NextPositiveDouble()
const {
35 return Double(u_ + 1).Value();
38 bool Sign()
const {
return (u_ & kSignMask) != 0; }
39 uint64_t Significand()
const {
return u_ & kSignificandMask; }
40 int Exponent()
const {
return static_cast<int>(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); }
42 bool IsNan()
const {
return (u_ & kExponentMask) == kExponentMask && Significand() != 0; }
43 bool IsInf()
const {
return (u_ & kExponentMask) == kExponentMask && Significand() == 0; }
44 bool IsNanOrInf()
const {
return (u_ & kExponentMask) == kExponentMask; }
45 bool IsNormal()
const {
return (u_ & kExponentMask) != 0 || Significand() == 0; }
46 bool IsZero()
const {
return (u_ & (kExponentMask | kSignificandMask)) == 0; }
48 uint64_t IntegerSignificand()
const {
return IsNormal() ? Significand() | kHiddenBit : Significand(); }
49 int IntegerExponent()
const {
return (IsNormal() ? Exponent() : kDenormalExponent) - kSignificandSize; }
50 uint64_t ToBias()
const {
return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask; }
52 static int EffectiveSignificandSize(
int order) {
55 else if (order <= -1074)
62 static const int kSignificandSize = 52;
63 static const int kExponentBias = 0x3FF;
64 static const int kDenormalExponent = 1 - kExponentBias;