TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
internal::Double Class Reference

#include <ieee754.h>

Public Member Functions

 Double ()
 
 Double (double d)
 
 Double (uint64_t u)
 
double Value () const
 
uint64_t Uint64Value () const
 
double NextPositiveDouble () const
 
bool Sign () const
 
uint64_t Significand () const
 
int Exponent () const
 
bool IsNan () const
 
bool IsInf () const
 
bool IsNormal () const
 
bool IsZero () const
 
uint64_t IntegerSignificand () const
 
int IntegerExponent () const
 
uint64_t ToBias () const
 

Static Public Member Functions

static unsigned EffectiveSignificandSize (int order)
 

Private Attributes

union {
   double   d_
 
   uint64_t   u_
 
}; 
 

Static Private Attributes

static const int kSignificandSize = 52
 
static const int kExponentBias = 0x3FF
 
static const int kDenormalExponent = 1 - kExponentBias
 
static const uint64_t kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000)
 
static const uint64_t kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000)
 
static const uint64_t kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF)
 
static const uint64_t kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000)
 

Constructor & Destructor Documentation

internal::Double::Double ( )
inline
25 {}

+ Here is the caller graph for this function:

internal::Double::Double ( double  d)
inline
26 : d_(d) {}
double d_
Definition: ieee754.h:69
internal::Double::Double ( uint64_t  u)
inline
27 : u_(u) {}
uint64_t u_
Definition: ieee754.h:70

Member Function Documentation

static unsigned internal::Double::EffectiveSignificandSize ( int  order)
inlinestatic
50  {
51  if (order >= -1021)
52  return 53;
53  else if (order <= -1074)
54  return 0;
55  else
56  return order + 1074;
57  }

+ Here is the caller graph for this function:

int internal::Double::Exponent ( ) const
inline
39 { return static_cast<int>(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); }
static const int kSignificandSize
Definition: ieee754.h:60
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kExponentMask
Definition: ieee754.h:64
static const int kExponentBias
Definition: ieee754.h:61

+ Here is the caller graph for this function:

int internal::Double::IntegerExponent ( ) const
inline
static const int kSignificandSize
Definition: ieee754.h:60
bool IsNormal() const
Definition: ieee754.h:43
static const int kDenormalExponent
Definition: ieee754.h:62
int Exponent() const
Definition: ieee754.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t internal::Double::IntegerSignificand ( ) const
inline
46 { return IsNormal() ? Significand() | kHiddenBit : Significand(); }
uint64_t Significand() const
Definition: ieee754.h:38
bool IsNormal() const
Definition: ieee754.h:43
static const uint64_t kHiddenBit
Definition: ieee754.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool internal::Double::IsInf ( ) const
inline
42 { return (u_ & kExponentMask) == kExponentMask && Significand() == 0; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kExponentMask
Definition: ieee754.h:64
uint64_t Significand() const
Definition: ieee754.h:38

+ Here is the call graph for this function:

bool internal::Double::IsNan ( ) const
inline
41 { return (u_ & kExponentMask) == kExponentMask && Significand() != 0; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kExponentMask
Definition: ieee754.h:64
uint64_t Significand() const
Definition: ieee754.h:38

+ Here is the call graph for this function:

bool internal::Double::IsNormal ( ) const
inline
43 { return (u_ & kExponentMask) != 0 || Significand() == 0; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kExponentMask
Definition: ieee754.h:64
uint64_t Significand() const
Definition: ieee754.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool internal::Double::IsZero ( ) const
inline
44 { return (u_ & (kExponentMask | kSignificandMask)) == 0; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kExponentMask
Definition: ieee754.h:64
static const uint64_t kSignificandMask
Definition: ieee754.h:65

+ Here is the caller graph for this function:

double internal::Double::NextPositiveDouble ( ) const
inline
32  {
34  return Double(u_ + 1).Value();
35  }
uint64_t u_
Definition: ieee754.h:70
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
Double()
Definition: ieee754.h:25
bool Sign() const
Definition: ieee754.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool internal::Double::Sign ( ) const
inline
37 { return (u_ & kSignMask) != 0; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kSignMask
Definition: ieee754.h:63

+ Here is the caller graph for this function:

uint64_t internal::Double::Significand ( ) const
inline
38 { return u_ & kSignificandMask; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kSignificandMask
Definition: ieee754.h:65

+ Here is the caller graph for this function:

uint64_t internal::Double::ToBias ( ) const
inline
48 { return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask; }
uint64_t u_
Definition: ieee754.h:70
static const uint64_t kSignMask
Definition: ieee754.h:63
uint64_t internal::Double::Uint64Value ( ) const
inline
30 { return u_; }
uint64_t u_
Definition: ieee754.h:70
double internal::Double::Value ( ) const
inline
29 { return d_; }
double d_
Definition: ieee754.h:69

+ Here is the caller graph for this function:

Member Data Documentation

union { ... }
double internal::Double::d_
const int internal::Double::kDenormalExponent = 1 - kExponentBias
staticprivate
const int internal::Double::kExponentBias = 0x3FF
staticprivate
const uint64_t internal::Double::kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000)
staticprivate
const uint64_t internal::Double::kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000)
staticprivate
const uint64_t internal::Double::kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF)
staticprivate
const int internal::Double::kSignificandSize = 52
staticprivate
const uint64_t internal::Double::kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000)
staticprivate
uint64_t internal::Double::u_

The documentation for this class was generated from the following file: