Custom precision long double class.
More...
#include <custom-precision-double.h>
|
| constexpr PDouble | operator+ (const PDouble &left, const PDouble &right) |
| |
| constexpr PDouble | operator- (const PDouble &left, const PDouble &right) |
| |
| constexpr PDouble | operator/ (const PDouble &left, const PDouble &right) |
| |
| constexpr PDouble | operator* (const PDouble &left, const PDouble &right) |
| |
| constexpr PDouble | operator% (const PDouble &left, const PDouble &right) |
| |
| constexpr PDouble & | operator+= (PDouble &left, const PDouble &right) |
| |
| constexpr PDouble & | operator-= (PDouble &left, const PDouble &right) |
| |
| constexpr PDouble & | operator/= (PDouble &left, const PDouble &right) |
| |
| constexpr PDouble & | operator*= (PDouble &left, const PDouble &right) |
| |
| constexpr PDouble & | operator%= (PDouble &left, const PDouble &right) |
| |
| constexpr bool | operator== (const PDouble &left, const PDouble &right) |
| |
| constexpr bool | operator!= (const PDouble &left, const PDouble &right) |
| |
| constexpr bool | operator> (const PDouble &left, const PDouble &right) |
| |
| constexpr bool | operator< (const PDouble &left, const PDouble &right) |
| |
| constexpr bool | operator>= (const PDouble &left, const PDouble &right) |
| |
| constexpr bool | operator<= (const PDouble &left, const PDouble &right) |
| |
| std::ostream & | operator<< (std::ostream &os, const PDouble &instance) |
| |
| std::istream & | operator>> (std::istream &is, PDouble &instance) |
| |
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() [1/3]
| constexpr woss::PDouble::PDouble |
( |
const long double |
input = 0.0, |
|
|
const long double |
precision = PDOUBLE_DEFAULT_PRECISION |
|
) |
| |
|
inlineconstexprnoexcept |
PDouble constructor
- Parameters
-
| input | value to store |
| precision | custom precision |
◆ PDouble() [2/3]
| woss::PDouble::PDouble |
( |
const PDouble & |
copy | ) |
|
|
defaultnoexcept |
PDouble copy constructor
- Parameters
-
◆ PDouble() [3/3]
| woss::PDouble::PDouble |
( |
PDouble && |
tmp | ) |
|
|
defaultnoexcept |
PDouble move constructor
- Parameters
-
◆ ~PDouble()
| woss::PDouble::~PDouble |
( |
| ) |
|
|
defaultnoexcept |
PDouble destructor. It is not virtual, since this class is not meant to be inherited from
◆ getPrecision()
| constexpr long double woss::PDouble::getPrecision |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Returns the custom precison
- Returns
- long double precision
References precision.
◆ getValue()
| constexpr long double woss::PDouble::getValue |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Returns the custom value
- Returns
- long double value
References value.
◆ operator double()
| constexpr woss::PDouble::operator double |
( |
| ) |
const |
|
inlineconstexpr |
double cast operator
- Returns
- a copy of value casted to double
◆ operator float()
| constexpr woss::PDouble::operator float |
( |
| ) |
const |
|
inlineconstexpr |
float cast operator
- Returns
- a copy of value casted to float
◆ operator int()
| constexpr woss::PDouble::operator int |
( |
| ) |
const |
|
inlineconstexpr |
int cast operator
- Returns
- a copy of value casted to int
◆ operator long double()
| constexpr woss::PDouble::operator long double |
( |
| ) |
const |
|
inlineconstexpr |
long double cast operator
- Returns
- a copy of value casted to long double
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ setPrecision()
| constexpr void woss::PDouble::setPrecision |
( |
double |
value | ) |
|
|
inlineconstexprnoexcept |
◆ operator!=
| constexpr bool operator!= |
( |
const PDouble & |
left, |
|
|
const PDouble & |
right |
|
) |
| |
|
friend |
Inequality operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- true if left != right, false otherwise
◆ operator%
Modulo operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- a new const instance holding the operation result
◆ operator%=
Compound assignment modulo operator
- Parameters
-
| left | left operand reference |
| right | right operand const reference |
- Returns
- left reference after the operation
◆ operator*
Multiplication operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- a new const instance holding the operation result
◆ operator*=
Compound assignment multiplication operator
- Parameters
-
| left | left operand reference |
| right | right operand const reference |
- Returns
- left reference after the operation
◆ operator+
Sum operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- a new const instance holding the operation result
◆ operator+=
Compound assignment sum operator
- Parameters
-
| left | left operand reference |
| right | right operand const reference |
- Returns
- left reference after the operation
◆ operator-
Subtraction operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- a new const instance holding the operation result
◆ operator-=
Compound assignment subtraction operator
- Parameters
-
| left | left operand reference |
| right | right operand const reference |
- Returns
- left reference after the operation
◆ operator/
Division operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- a new const instance holding the operation result
◆ operator/=
Compound assignment division operator
- Parameters
-
| left | left operand reference |
| right | right operand const reference |
- Returns
- left reference after the operation
◆ operator<
| constexpr bool operator< |
( |
const PDouble & |
left, |
|
|
const PDouble & |
right |
|
) |
| |
|
friend |
Less than operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- true if left < right, false otherwise
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const PDouble & |
instance |
|
) |
| |
|
friend |
<< operator
- Parameters
-
| os | left operand ostream reference |
| instance | right operand const PDouble reference |
- Returns
- os reference after the operation
◆ operator<=
| constexpr bool operator<= |
( |
const PDouble & |
left, |
|
|
const PDouble & |
right |
|
) |
| |
|
friend |
Less than or equal to operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- true if left <= right, false otherwise
◆ operator==
| constexpr bool operator== |
( |
const PDouble & |
left, |
|
|
const PDouble & |
right |
|
) |
| |
|
friend |
Equality operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- true if left == right, false otherwise
◆ operator>
| constexpr bool operator> |
( |
const PDouble & |
left, |
|
|
const PDouble & |
right |
|
) |
| |
|
friend |
Greater than operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- true if left > right, false otherwise
◆ operator>=
| constexpr bool operator>= |
( |
const PDouble & |
left, |
|
|
const PDouble & |
right |
|
) |
| |
|
friend |
Greater than or equal to operator
- Parameters
-
| left | left operand const reference |
| right | right operand const reference |
- Returns
- true if left >= right, false otherwise
◆ operator>>
| std::istream & operator>> |
( |
std::istream & |
is, |
|
|
PDouble & |
instance |
|
) |
| |
|
friend |
operator
- Parameters
-
| is | left operand istream reference |
| instance | right operand PDouble reference. It will take the value provided by left with default precision |
- Returns
- is reference after the operation
◆ precision
| long double woss::PDouble::precision |
|
protected |
◆ value
| long double woss::PDouble::value |
|
protected |
The documentation for this class was generated from the following file: