IN2OSM  1.0.1
Double

#include <ieee754.h>

Collaboration diagram for Double:
Collaboration graph

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 IsNanOrInf () const
 
bool IsNormal () const
 
bool IsZero () const
 
uint64_t IntegerSignificand () const
 
int IntegerExponent () const
 
uint64_t ToBias () const
 

Static Public Member Functions

static int 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)
 

Detailed Description

Definition at line 23 of file ieee754.h.

Constructor & Destructor Documentation

◆ Double() [1/3]

Double ( )
inline

Definition at line 25 of file ieee754.h.

25 {}
Here is the caller graph for this function:

◆ Double() [2/3]

Double ( double  d)
inline

Definition at line 26 of file ieee754.h.

26 : d_(d) {}

◆ Double() [3/3]

Double ( uint64_t  u)
inline

Definition at line 27 of file ieee754.h.

27 : u_(u) {}
uint64_t u_
Definition: ieee754.h:71

Member Function Documentation

◆ EffectiveSignificandSize()

static int EffectiveSignificandSize ( int  order)
inlinestatic

Definition at line 51 of file ieee754.h.

51  {
52  if (order >= -1021)
53  return 53;
54  else if (order <= -1074)
55  return 0;
56  else
57  return order + 1074;
58  }
Here is the caller graph for this function:

◆ Exponent()

int Exponent ( ) const
inline

Definition at line 39 of file ieee754.h.

39 { return static_cast<int>(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); }
static const uint64_t kExponentMask
Definition: ieee754.h:65
static const int kExponentBias
Definition: ieee754.h:62
uint64_t u_
Definition: ieee754.h:71
static const int kSignificandSize
Definition: ieee754.h:61
Here is the caller graph for this function:

◆ IntegerExponent()

int IntegerExponent ( ) const
inline

Definition at line 48 of file ieee754.h.

static const int kDenormalExponent
Definition: ieee754.h:63
int Exponent() const
Definition: ieee754.h:39
bool IsNormal() const
Definition: ieee754.h:44
static const int kSignificandSize
Definition: ieee754.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IntegerSignificand()

uint64_t IntegerSignificand ( ) const
inline

Definition at line 47 of file ieee754.h.

47 { return IsNormal() ? Significand() | kHiddenBit : Significand(); }
static const uint64_t kHiddenBit
Definition: ieee754.h:67
uint64_t Significand() const
Definition: ieee754.h:38
bool IsNormal() const
Definition: ieee754.h:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsInf()

bool IsInf ( ) const
inline

Definition at line 42 of file ieee754.h.

42 { return (u_ & kExponentMask) == kExponentMask && Significand() == 0; }
static const uint64_t kExponentMask
Definition: ieee754.h:65
uint64_t Significand() const
Definition: ieee754.h:38
uint64_t u_
Definition: ieee754.h:71
Here is the call graph for this function:

◆ IsNan()

bool IsNan ( ) const
inline

Definition at line 41 of file ieee754.h.

41 { return (u_ & kExponentMask) == kExponentMask && Significand() != 0; }
static const uint64_t kExponentMask
Definition: ieee754.h:65
uint64_t Significand() const
Definition: ieee754.h:38
uint64_t u_
Definition: ieee754.h:71
Here is the call graph for this function:

◆ IsNanOrInf()

bool IsNanOrInf ( ) const
inline

Definition at line 43 of file ieee754.h.

43 { return (u_ & kExponentMask) == kExponentMask; }
static const uint64_t kExponentMask
Definition: ieee754.h:65
uint64_t u_
Definition: ieee754.h:71

◆ IsNormal()

bool IsNormal ( ) const
inline

Definition at line 44 of file ieee754.h.

44 { return (u_ & kExponentMask) != 0 || Significand() == 0; }
static const uint64_t kExponentMask
Definition: ieee754.h:65
uint64_t Significand() const
Definition: ieee754.h:38
uint64_t u_
Definition: ieee754.h:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsZero()

bool IsZero ( ) const
inline

Definition at line 45 of file ieee754.h.

45 { return (u_ & (kExponentMask | kSignificandMask)) == 0; }
static const uint64_t kSignificandMask
Definition: ieee754.h:66
static const uint64_t kExponentMask
Definition: ieee754.h:65
uint64_t u_
Definition: ieee754.h:71
Here is the caller graph for this function:

◆ NextPositiveDouble()

double NextPositiveDouble ( ) const
inline

Definition at line 32 of file ieee754.h.

32  {
34  return Double(u_ + 1).Value();
35  }
bool Sign() const
Definition: ieee754.h:37
uint64_t u_
Definition: ieee754.h:71
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sign()

bool Sign ( ) const
inline

Definition at line 37 of file ieee754.h.

37 { return (u_ & kSignMask) != 0; }
static const uint64_t kSignMask
Definition: ieee754.h:64
uint64_t u_
Definition: ieee754.h:71
Here is the caller graph for this function:

◆ Significand()

uint64_t Significand ( ) const
inline

Definition at line 38 of file ieee754.h.

38 { return u_ & kSignificandMask; }
static const uint64_t kSignificandMask
Definition: ieee754.h:66
uint64_t u_
Definition: ieee754.h:71
Here is the caller graph for this function:

◆ ToBias()

uint64_t ToBias ( ) const
inline

Definition at line 49 of file ieee754.h.

49 { return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask; }
static const uint64_t kSignMask
Definition: ieee754.h:64
uint64_t u_
Definition: ieee754.h:71

◆ Uint64Value()

uint64_t Uint64Value ( ) const
inline

Definition at line 30 of file ieee754.h.

30 { return u_; }
uint64_t u_
Definition: ieee754.h:71

◆ Value()

double Value ( ) const
inline

Definition at line 29 of file ieee754.h.

29 { return d_; }
Here is the caller graph for this function:

Member Data Documentation

◆ @8

union { ... }

◆ d_

double d_

Definition at line 70 of file ieee754.h.

◆ kDenormalExponent

const int kDenormalExponent = 1 - kExponentBias
staticprivate

Definition at line 63 of file ieee754.h.

◆ kExponentBias

const int kExponentBias = 0x3FF
staticprivate

Definition at line 62 of file ieee754.h.

◆ kExponentMask

const uint64_t kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000)
staticprivate

Definition at line 65 of file ieee754.h.

◆ kHiddenBit

const uint64_t kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000)
staticprivate

Definition at line 67 of file ieee754.h.

◆ kSignificandMask

const uint64_t kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF)
staticprivate

Definition at line 66 of file ieee754.h.

◆ kSignificandSize

const int kSignificandSize = 52
staticprivate

Definition at line 61 of file ieee754.h.

◆ kSignMask

const uint64_t kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000)
staticprivate

Definition at line 64 of file ieee754.h.

◆ u_

Definition at line 71 of file ieee754.h.


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