#include <high-precision-128.h>
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 |
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.
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 | ) |
Definition at line 80 of file high-precision-128.cc.
References _cairo_int128_add, _cairo_int128_lsl, _cairo_int64_to_int128(), _cairo_uint128_to_int128, _cairo_uint64_to_uint128(), m_fastValue, m_isFast, m_slowValue, and MAX_64.
ns3::HighPrecision::HighPrecision | ( | ) |
ns3::HighPrecision::HighPrecision | ( | int64_t | value, | |
bool | dummy | |||
) |
ns3::HighPrecision::HighPrecision | ( | double | value | ) |
bool ns3::HighPrecision::Add | ( | HighPrecision const & | o | ) |
bool ns3::HighPrecision::Add | ( | HighPrecision const & | o | ) | [inline] |
Definition at line 155 of file high-precision-128.h.
References HP128INC, m_fastValue, m_isFast, and SlowAdd().
Referenced by ns3::operator+(), ns3::operator+=(), and ns3::HighPrecision128Tests::RunTests().
int ns3::HighPrecision::Compare | ( | HighPrecision const & | o | ) | const |
int ns3::HighPrecision::Compare | ( | HighPrecision const & | o | ) | const [inline] |
Definition at line 201 of file high-precision-128.h.
References HP128INC, m_fastValue, m_isFast, and SlowCompare().
Referenced by ns3::TimeUnit< 0 >::IsNegative(), ns3::TimeUnit< 1 >::IsNegative(), ns3::TimeUnit< N >::IsNegative(), ns3::TimeUnit< 0 >::IsPositive(), ns3::TimeUnit< 1 >::IsPositive(), ns3::TimeUnit< N >::IsPositive(), ns3::TimeUnit< 0 >::IsStrictlyNegative(), ns3::TimeUnit< 1 >::IsStrictlyNegative(), ns3::TimeUnit< N >::IsStrictlyNegative(), ns3::TimeUnit< 0 >::IsStrictlyPositive(), ns3::TimeUnit< 1 >::IsStrictlyPositive(), ns3::TimeUnit< N >::IsStrictlyPositive(), ns3::TimeUnit< 0 >::IsZero(), ns3::TimeUnit< 1 >::IsZero(), ns3::TimeUnit< N >::IsZero(), ns3::operator!=(), ns3::operator==(), ns3::operator>(), and ns3::operator>=().
bool ns3::HighPrecision::Div | ( | HighPrecision const & | o | ) |
bool ns3::HighPrecision::Div | ( | HighPrecision const & | o | ) |
Definition at line 159 of file high-precision-128.cc.
References _cairo_int128_add, _cairo_int128_divrem(), _cairo_int128_eq, _cairo_int128_lsl, _cairo_int128_rsa, _cairo_int64_to_int128(), EnsureSlow(), HP128INC, m_slowValue, _cairo_quorem128::quo, and _cairo_quorem128::rem.
Referenced by ns3::operator/(), and ns3::HighPrecision128Tests::RunTests().
void ns3::HighPrecision::EnsureSlow | ( | void | ) | [inline, private] |
Definition at line 101 of file high-precision-128.cc.
References _cairo_int128_lsl, _cairo_int64_to_int128(), HP128INC, m_fastValue, m_isFast, and m_slowValue.
Referenced by Div(), SlowAdd(), SlowCompare(), SlowMul(), and SlowSub().
double ns3::HighPrecision::GetDouble | ( | void | ) | const |
double ns3::HighPrecision::GetDouble | ( | void | ) | const [inline] |
Definition at line 140 of file high-precision-128.h.
References HP128INC, m_fastValue, m_isFast, and SlowGetDouble().
Referenced by ns3::TimeUnit< 0 >::GetDouble(), ns3::TimeUnit< 1 >::GetSeconds(), ns3::operator/(), and ns3::HighPrecision128Tests::RunTests().
int64_t ns3::HighPrecision::GetInteger | ( | void | ) | const |
int64_t ns3::HighPrecision::GetInteger | ( | void | ) | const [inline] |
Definition at line 127 of file high-precision-128.h.
References HP128INC, m_fastValue, m_isFast, and SlowGetInteger().
Referenced by ns3::TimeTests::CheckOld(), ns3::TimeTests::CheckOperations(), and ns3::TimeUnit< 1 >::GetTimeStep().
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] |
Definition at line 120 of file high-precision-128.cc.
References _cairo_int128_negate, _cairo_int128_negative, _cairo_int128_rsa, _cairo_int128_sub, _cairo_uint128_lsl(), _cairo_uint128_to_uint64, m_slowValue, and MAX_64.
Referenced by GetDouble().
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] |
Definition at line 170 of file high-precision-128.h.
References HP128INC, m_fastValue, m_isFast, and SlowSub().
Referenced by ns3::operator-(), ns3::operator-=(), and ns3::HighPrecision128Tests::RunTests().
static HighPrecision ns3::HighPrecision::Zero | ( | void | ) | [static] |
HighPrecision ns3::HighPrecision::Zero | ( | void | ) | [inline, static] |
Definition at line 229 of file high-precision-128.h.
References HighPrecision().
Referenced by ns3::TimeUnit< 0 >::IsNegative(), ns3::TimeUnit< 1 >::IsNegative(), ns3::TimeUnit< N >::IsNegative(), ns3::TimeUnit< 0 >::IsPositive(), ns3::TimeUnit< 1 >::IsPositive(), ns3::TimeUnit< N >::IsPositive(), ns3::TimeUnit< 0 >::IsStrictlyNegative(), ns3::TimeUnit< 1 >::IsStrictlyNegative(), ns3::TimeUnit< N >::IsStrictlyNegative(), ns3::TimeUnit< 0 >::IsStrictlyPositive(), ns3::TimeUnit< 1 >::IsStrictlyPositive(), ns3::TimeUnit< N >::IsStrictlyPositive(), ns3::TimeUnit< 0 >::IsZero(), ns3::TimeUnit< 1 >::IsZero(), and ns3::TimeUnit< N >::IsZero().
int64_t ns3::HighPrecision::m_fastValue [private] |
Definition at line 92 of file high-precision-128.h.
Referenced by Add(), Compare(), EnsureSlow(), GetDouble(), GetInteger(), HighPrecision(), Mul(), and Sub().
bool ns3::HighPrecision::m_isFast [private] |
Definition at line 91 of file high-precision-128.h.
Referenced by Add(), Compare(), EnsureSlow(), GetDouble(), GetInteger(), HighPrecision(), Mul(), and Sub().
Definition at line 93 of file high-precision-128.h.
Referenced by Div(), EnsureSlow(), HighPrecision(), SlowAdd(), SlowCompare(), SlowGetDouble(), SlowGetInteger(), SlowMul(), and SlowSub().
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().