7#ifndef INT64X64_DOUBLE_H
8#define INT64X64_DOUBLE_H
10#include "ns3/core-config.h"
12#if defined(INT64X64_USE_DOUBLE) || defined(PYTHON_SCAN)
36 static const uint64_t
HP_MASK_LO = 0xffffffffffffffffULL;
40 static constexpr long double HP_MAX_64 = (
static_cast<uint64_t
>(1) << 63) * 2.0L;
135 const long double hild =
static_cast<long double>(hi);
166 inline explicit operator bool()
const
193 long double flo = std::modf(v, &
fhi);
202 const long double round = 0.5;
204 int64_t hi =
static_cast<int64_t
>(
fhi);
205 uint64_t lo =
static_cast<uint64_t
>(
flo);
220 return std::make_pair(hi, lo);
251 int64_t
retval =
static_cast<int64_t
>(
_v);
308 return lhs._v == rhs._v;
313 return lhs._v < rhs._v;
318 return lhs._v > rhs._v;
High precision numerical type, implementing Q64.64 fixed precision.
int64_t GetHigh() const
Get the integer portion.
int64x64_t(unsigned long int v)
Construct from an integral type.
int64x64_t(int v)
Construct from an integral type.
friend bool operator==(const int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
static const uint64_t HP_MASK_LO
Mask for fraction part.
impl_type
Type tag for the underlying implementation.
@ int128_impl
Native int128_t implementation.
@ ld_impl
long double implementation.
@ cairo_impl
Cairo wideint implementation.
static int64x64_t Invert(uint64_t v)
Compute the inverse of an integer value.
friend int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
friend int64x64_t operator+(const int64x64_t &lhs)
Unary operator.
static constexpr long double HP_MAX_64
Floating point value of HP_MASK_LO + 1.
int64x64_t(long double value)
Constructor from a floating point.
int64x64_t(unsigned int v)
Construct from an integral type.
int64_t Round() const
Round to the nearest int.
void MulByInvert(const int64x64_t &o)
Multiply this value by a Q0.128 value, presumably representing an inverse, completing a division oper...
friend bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
static enum impl_type implementation
Type tag for this implementation.
friend int64x64_t operator!(const int64x64_t &lhs)
Unary operator.
int128_t _v
The Q64.64 value.
int64x64_t(unsigned long long int v)
Construct from an integral type.
friend int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
int64x64_t(long long int v)
Construct from an integral type.
int64x64_t(int64_t hi, uint64_t lo)
Construct from explicit high and low values.
double GetDouble() const
Get this value as a double.
friend int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
int64_t GetInt() const
Truncate to an integer.
int64x64_t & operator=(const int64x64_t &o)
Assignment.
friend bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
long double _v
The Q64.64 value.
std::pair< int64_t, uint64_t > GetHighLow() const
Get the high and low portions of this value.
uint64_t GetLow() const
Get the fractional portion of this value, unscaled.
int64x64_t(double value)
Constructor from a floating point.
friend int64x64_t operator-(const int64x64_t &lhs)
Unary operator.
int64x64_t(const int64x64_t &o)
Copy constructor.
friend int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
int64x64_t()
Default constructor.
int64x64_t(long int v)
Construct from an integral type.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static unsigned int value(char c)