ns3::HighPrecision Class Reference

#include <high-precision-128.h>

Collaboration diagram for ns3::HighPrecision:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HighPrecision ()
 HighPrecision (int64_t value, bool dummy)
 HighPrecision (double value)
int64_t GetInteger (void) const
double GetDouble (void) const
bool Add (HighPrecision const &o)
bool Sub (HighPrecision const &o)
bool Mul (HighPrecision const &o)
bool Div (HighPrecision const &o)
int Compare (HighPrecision const &o) const
 HighPrecision ()
 HighPrecision (int64_t value, bool dummy)
 HighPrecision (double value)
int64_t GetInteger (void) const
double GetDouble (void) const
bool Add (HighPrecision const &o)
bool Sub (HighPrecision const &o)
bool Mul (HighPrecision const &o)
bool Div (HighPrecision const &o)
int Compare (HighPrecision const &o) const

Static Public Member Functions

static void PrintStats (void)
static HighPrecision Zero (void)
static HighPrecision Zero (void)

Private Member Functions

int64_t SlowGetInteger (void) const
double SlowGetDouble (void) const
bool SlowAdd (HighPrecision const &o)
bool SlowSub (HighPrecision const &o)
bool SlowMul (HighPrecision const &o)
int SlowCompare (HighPrecision const &o) const
void EnsureSlow (void)

Private Attributes

bool m_isFast
int64_t m_fastValue
cairo_int128_t m_slowValue
double m_value

Static Private Attributes

static const double MAX_64 = 18446744073709551615.0

Detailed Description

Obviously, this implementation of the HighPrecision class does not provide the 128 bits accuracy since it uses a an IEEE754 double to store the value. It also does not report overflows. So, it is a nice shortcut but in no way a complete solution.

Definition at line 63 of file high-precision-128.h.


Constructor & Destructor Documentation

ns3::HighPrecision::HighPrecision (  )  [inline]

Definition at line 115 of file high-precision-128.h.

Referenced by Zero().

ns3::HighPrecision::HighPrecision ( int64_t  value,
bool  dummy 
) [inline]

Definition at line 120 of file high-precision-128.h.

ns3::HighPrecision::HighPrecision ( double  value  ) 
ns3::HighPrecision::HighPrecision (  ) 
ns3::HighPrecision::HighPrecision ( int64_t  value,
bool  dummy 
)
ns3::HighPrecision::HighPrecision ( double  value  ) 

Member Function Documentation

bool ns3::HighPrecision::Add ( HighPrecision const &  o  ) 
bool ns3::HighPrecision::Add ( HighPrecision const &  o  )  [inline]
int ns3::HighPrecision::Compare ( HighPrecision const &  o  )  const
int ns3::HighPrecision::Compare ( HighPrecision const &  o  )  const [inline]
bool ns3::HighPrecision::Div ( HighPrecision const &  o  ) 
bool ns3::HighPrecision::Div ( HighPrecision const &  o  ) 
void ns3::HighPrecision::EnsureSlow ( void   )  [inline, private]
double ns3::HighPrecision::GetDouble ( void   )  const
double ns3::HighPrecision::GetDouble ( void   )  const [inline]
int64_t ns3::HighPrecision::GetInteger ( void   )  const
int64_t ns3::HighPrecision::GetInteger ( void   )  const [inline]
bool ns3::HighPrecision::Mul ( HighPrecision const &  o  ) 
bool ns3::HighPrecision::Mul ( HighPrecision const &  o  )  [inline]

Definition at line 185 of file high-precision-128.h.

References HP128INC, m_fastValue, m_isFast, and SlowMul().

Referenced by ns3::operator*(), and ns3::HighPrecision128Tests::RunTests().

void ns3::HighPrecision::PrintStats ( void   )  [static]

Definition at line 72 of file high-precision-128.cc.

bool ns3::HighPrecision::SlowAdd ( HighPrecision const &  o  )  [private]

Definition at line 134 of file high-precision-128.cc.

References _cairo_int128_add, EnsureSlow(), and m_slowValue.

Referenced by Add().

int ns3::HighPrecision::SlowCompare ( HighPrecision const &  o  )  const [private]

Definition at line 185 of file high-precision-128.cc.

References _cairo_int128_eq, _cairo_int128_lt(), EnsureSlow(), and m_slowValue.

Referenced by Compare().

double ns3::HighPrecision::SlowGetDouble ( void   )  const [private]
int64_t ns3::HighPrecision::SlowGetInteger ( void   )  const [private]

Definition at line 113 of file high-precision-128.cc.

References _cairo_int128_rsa, _cairo_int128_to_int64, and m_slowValue.

Referenced by GetInteger().

bool ns3::HighPrecision::SlowMul ( HighPrecision const &  o  )  [private]

Definition at line 150 of file high-precision-128.cc.

References _cairo_int128_mul, _cairo_int128_rsa, EnsureSlow(), and m_slowValue.

Referenced by Mul().

bool ns3::HighPrecision::SlowSub ( HighPrecision const &  o  )  [private]

Definition at line 142 of file high-precision-128.cc.

References _cairo_int128_sub, EnsureSlow(), and m_slowValue.

Referenced by Sub().

bool ns3::HighPrecision::Sub ( HighPrecision const &  o  ) 
bool ns3::HighPrecision::Sub ( HighPrecision const &  o  )  [inline]
static HighPrecision ns3::HighPrecision::Zero ( void   )  [static]
HighPrecision ns3::HighPrecision::Zero ( void   )  [inline, static]

Member Data Documentation

Definition at line 92 of file high-precision-128.h.

Referenced by Add(), Compare(), EnsureSlow(), GetDouble(), GetInteger(), HighPrecision(), Mul(), and Sub().

Definition at line 91 of file high-precision-128.h.

Referenced by Add(), Compare(), EnsureSlow(), GetDouble(), GetInteger(), HighPrecision(), Mul(), and Sub().

double ns3::HighPrecision::m_value [private]

Definition at line 52 of file high-precision-double.h.

static const double ns3::HighPrecision::MAX_64 = 18446744073709551615.0 [static, private]

Definition at line 90 of file high-precision-128.h.

Referenced by HighPrecision(), and SlowGetDouble().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:12:13 2009 for NS-3 by  doxygen 1.6.3