World Ocean Simulation System (WOSS) library
custom-precision-double.h File Reference

Provides the interface for the woss::PDouble class. More...

Go to the source code of this file.

Classes

class  woss::PDouble
 Custom precision long double class. More...
 

Functions

const PDouble woss::operator+ (const PDouble &left, const PDouble &right)
 
const PDouble woss::operator- (const PDouble &left, const PDouble &right)
 
const PDouble woss::operator/ (const PDouble &left, const PDouble &right)
 
const PDouble woss::operator* (const PDouble &left, const PDouble &right)
 
const PDouble woss::operator% (const PDouble &left, const PDouble &right)
 
PDoublewoss::operator+= (PDouble &left, const PDouble &right)
 
PDoublewoss::operator-= (PDouble &left, const PDouble &right)
 
PDoublewoss::operator/= (PDouble &left, const PDouble &right)
 
PDoublewoss::operator*= (PDouble &left, const PDouble &right)
 
PDoublewoss::operator%= (PDouble &left, const PDouble &right)
 
bool woss::operator== (const PDouble &left, const PDouble &right)
 
bool woss::operator!= (const PDouble &left, const PDouble &right)
 
bool woss::operator> (const PDouble &left, const PDouble &right)
 
bool woss::operator< (const PDouble &left, const PDouble &right)
 
bool woss::operator>= (const PDouble &left, const PDouble &right)
 
bool woss::operator<= (const PDouble &left, const PDouble &right)
 
inline ::std::ostream & woss::operator<< (::std::ostream &os, const PDouble &instance)
 
inline ::std::istream & woss::operator>> (::std::istream &is, PDouble &instance)
 

Detailed Description

Provides the interface for the woss::PDouble class.

Author
Federico Guerra

Provides the interface for the PDouble class. PDouble stands for PrecisionDouble: the value and the precision provided are used for arithmetic computations and comparisons. This class is not intented for inheritance: all containers used in WOSS are based on PDouble objects, not pointers to objects. Therefore, inheritance requires modification in other classes, to prevent object slicing when inserting in containers PDouble-derived objects instead of PDouble objects. Moreover, due to intensive use of PDouble objects, using heap-based pointers adds another layer of indirection, therefore adding an efficiency penalty.

Function Documentation

◆ operator!=()

bool woss::operator!= ( const PDouble left,
const PDouble right 
)
inline

Inequality operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left != right, false otherwise

◆ operator%()

const PDouble woss::operator% ( const PDouble left,
const PDouble right 
)
inline

Modulo operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator%=()

PDouble & woss::operator%= ( PDouble left,
const PDouble right 
)
inline

Compound assignment modulo operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator*()

const PDouble woss::operator* ( const PDouble left,
const PDouble right 
)
inline

Multiplication operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator*=()

PDouble & woss::operator*= ( PDouble left,
const PDouble right 
)
inline

Compound assignment multiplication operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator+()

const PDouble woss::operator+ ( const PDouble left,
const PDouble right 
)
inline

Sum operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator+=()

PDouble & woss::operator+= ( PDouble left,
const PDouble right 
)
inline

Compound assignment sum operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator-()

const PDouble woss::operator- ( const PDouble left,
const PDouble right 
)
inline

Subtraction operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator-=()

PDouble & woss::operator-= ( PDouble left,
const PDouble right 
)
inline

Compound assignment subtraction operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator/()

const PDouble woss::operator/ ( const PDouble left,
const PDouble right 
)
inline

Division operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator/=()

PDouble & woss::operator/= ( PDouble left,
const PDouble right 
)
inline

Compound assignment division operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator<()

bool woss::operator< ( const PDouble left,
const PDouble right 
)
inline

Less than operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left < right, false otherwise

◆ operator<=()

bool woss::operator<= ( const PDouble left,
const PDouble right 
)
inline

Less than or equal to operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left <= right, false otherwise

◆ operator==()

bool woss::operator== ( const PDouble left,
const PDouble right 
)
inline

Equality operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left == right, false otherwise

◆ operator>()

bool woss::operator> ( const PDouble left,
const PDouble right 
)
inline

Greater than operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left > right, false otherwise

◆ operator>=()

bool woss::operator>= ( const PDouble left,
const PDouble right 
)
inline

Greater than or equal to operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left >= right, false otherwise