World Ocean Simulation System (WOSS) library
|
Custom precision long double class. More...
#include <custom-precision-double.h>
Public Member Functions | |
PDouble (const long double input=0.0, const long double precision=PDOUBLE_DEFAULT_PRECISION) | |
PDouble (const PDouble ©) | |
~PDouble () | |
void | setPrecision (double value) |
long double | getPrecision () const |
long double | getValue () const |
PDouble & | operator= (const PDouble ©) |
operator int () const | |
operator float () const | |
operator double () const | |
operator long double () const | |
friend::std::ostream & | operator<< (::std::ostream &os, const PDouble &instance) |
friend::std::istream & | operator>> (::std::istream &is, PDouble &instance) |
Static Public Member Functions | |
static void | setDebug (bool flag) |
Protected Attributes | |
long double | value |
long double | precision |
Static Protected Attributes | |
static bool | debug = false |
Friends | |
const PDouble | operator+ (const PDouble &left, const PDouble &right) |
const PDouble | operator- (const PDouble &left, const PDouble &right) |
const PDouble | operator/ (const PDouble &left, const PDouble &right) |
const PDouble | operator* (const PDouble &left, const PDouble &right) |
const PDouble | operator% (const PDouble &left, const PDouble &right) |
PDouble & | operator+= (PDouble &left, const PDouble &right) |
PDouble & | operator-= (PDouble &left, const PDouble &right) |
PDouble & | operator/= (PDouble &left, const PDouble &right) |
PDouble & | operator*= (PDouble &left, const PDouble &right) |
PDouble & | operator%= (PDouble &left, const PDouble &right) |
bool | operator== (const PDouble &left, const PDouble &right) |
bool | operator!= (const PDouble &left, const PDouble &right) |
bool | operator> (const PDouble &left, const PDouble &right) |
bool | operator< (const PDouble &left, const PDouble &right) |
bool | operator>= (const PDouble &left, const PDouble &right) |
bool | operator<= (const PDouble &left, const PDouble &right) |
Custom precision long double class.
The PDouble class stores a long double value and a long double precision for arithmetic computation and comparison purposes.
PDouble::PDouble | ( | const long double | input = 0.0 , |
const long double | precision = PDOUBLE_DEFAULT_PRECISION |
||
) |
PDouble constructor
input | value to store |
precision | custom precision |
PDouble::PDouble | ( | const PDouble & | copy | ) |
PDouble::~PDouble | ( | ) |
PDouble destructor. It is not virtual, since this class is not meant to be inherited from
|
inline |
|
inline |
|
inline |
double cast operator
|
inline |
float cast operator
|
inline |
int cast operator
|
inline |
long double cast operator
friend::std::ostream & woss::PDouble::operator<< | ( | ::std::ostream & | os, |
const PDouble & | instance | ||
) |
<< operator
os | left operand ostream reference |
instance | right operand const PDouble reference |
friend::std::istream & woss::PDouble::operator>> | ( | ::std::istream & | is, |
PDouble & | instance | ||
) |
operator
is | left operand istream reference |
instance | right operand PDouble reference. It will take the value provided by left with default precision |
|
inlinestatic |
|
inline |
Inequality operator
left | left operand const reference |
right | right operand const reference |
Modulo operator
left | left operand const reference |
right | right operand const reference |
Compound assignment modulo operator
left | left operand reference |
right | right operand const reference |
Multiplication operator
left | left operand const reference |
right | right operand const reference |
Compound assignment multiplication operator
left | left operand reference |
right | right operand const reference |
Sum operator
left | left operand const reference |
right | right operand const reference |
Compound assignment sum operator
left | left operand reference |
right | right operand const reference |
Subtraction operator
left | left operand const reference |
right | right operand const reference |
Compound assignment subtraction operator
left | left operand reference |
right | right operand const reference |
Division operator
left | left operand const reference |
right | right operand const reference |
Compound assignment division operator
left | left operand reference |
right | right operand const reference |
Less than operator
left | left operand const reference |
right | right operand const reference |
Less than or equal to operator
left | left operand const reference |
right | right operand const reference |
Equality operator
left | left operand const reference |
right | right operand const reference |
Greater than operator
left | left operand const reference |
right | right operand const reference |
Greater than or equal to operator
left | left operand const reference |
right | right operand const reference |
|
staticprotected |
debug status
Referenced by setDebug().
|
protected |
stored precision
Referenced by getPrecision(), operator=(), PDouble(), and setPrecision().
|
protected |
stored value
Referenced by getValue(), operator=(), PDouble(), and setPrecision().