Pecunia 0.9.0-alpha.22
Library using the ISO-4217 currency standard & a fixed monetary unit size
|
Represents a safe type for working with floating-point operations. More...
#include <FloatingPoint.hpp>
Public Member Functions | |
FloatingPoint () | |
Fully initialises the value to zero. | |
FloatingPoint (const FloatingPointBase &value) | |
Fully initialises the value. | |
FloatingPoint (const std::int32_t &value) | |
Fully initialises the value. | |
FloatingPoint (const std::int64_t &value) | |
Fully initialises the value. | |
FloatingPoint | absoluteValue () const |
Performs the mathematical absolute value operation. | |
FloatingPoint | ceiling () const |
Performs the mathematical ceiling operation. | |
RealNumber | decompose (const std::uint8_t digits=defaultRoundingDigits) const |
Breaks a floating-point number into its whole and fractional components. | |
FloatingPoint | floor () const |
Performs the mathematical floor operation. | |
bool | isEqual (const FloatingPoint &other, const std::uint8_t digits=defaultRoundingDigits) const |
Determines if the supplied number is equal to within a specific number of digits. | |
FloatingPoint | modulo (const FloatingPoint &divisor) const |
Calculates the modulo operation, i.e. division remainder. | |
FloatingPoint | operator* (const FloatingPoint &other) const |
Calculates the multiplication operation. | |
FloatingPoint & | operator*= (const FloatingPoint &other) |
Calculates the multiplication and assignment operation. | |
FloatingPoint | operator+ (const FloatingPoint &other) const |
Calculates the addition operation. | |
FloatingPoint & | operator+= (const FloatingPoint &other) |
Calculates the addition and assignment operation. | |
FloatingPoint | operator- () const |
Negation operator. | |
FloatingPoint | operator- (const FloatingPoint &other) const |
Calculates the subtraction operation. | |
FloatingPoint & | operator-= (const FloatingPoint &other) |
Calculates the subtraction and assignment operation. | |
FloatingPoint | operator/ (const FloatingPoint &divisor) const |
Calculates the division operation. | |
FloatingPoint & | operator/= (const FloatingPoint &divisor) |
Calculates the division and assignment operation. | |
bool | operator< (const FloatingPoint &other) const noexcept |
Relationship operator checking the less-than status. | |
bool | operator< (const FloatingPointBase &other) const noexcept |
Relationship operator checking the less-than status. | |
bool | operator<= (const FloatingPoint &other) const =delete |
bool | operator<= (const FloatingPointBase &other) const =delete |
bool | operator== (const FloatingPoint &other) const =delete |
bool | operator== (const FloatingPointBase &other) const =delete |
bool | operator> (const FloatingPoint &other) const noexcept |
Relationship operator checking the greater-than status. | |
bool | operator> (const FloatingPointBase &other) const noexcept |
Relationship operator checking the greater-than status. | |
bool | operator>= (const FloatingPoint &other) const =delete |
bool | operator>= (const FloatingPointBase &other) const =delete |
FloatingPoint | power (const FloatingPoint &exponent) const |
Performs the exponentiation operation. | |
FloatingPoint | power (const std::int64_t &exponent) const |
Performs the exponentiation operation. | |
FloatingPoint | reciprocal () const |
Calculates the reciprocal of the current instance's value. | |
FloatingPoint | squareRoot () const |
Calculates the square root of the stored value. | |
std::string | toString () const |
Converts the float-point value into a string. | |
const FloatingPointBase & | underlying () const noexcept |
The unsafe type represented by the floating-point value. | |
Represents a safe type for working with floating-point operations.
pecunia::FloatingPoint::FloatingPoint | ( | ) |
Fully initialises the value to zero.
pecunia::FloatingPoint::FloatingPoint | ( | const FloatingPointBase & | value | ) |
Fully initialises the value.
value | The value to set the floating-point to. |
pecunia::FloatingPoint::FloatingPoint | ( | const std::int32_t & | value | ) |
Fully initialises the value.
value | The value to set the floating-point to. |
pecunia::FloatingPoint::FloatingPoint | ( | const std::int64_t & | value | ) |
Fully initialises the value.
value | The value to set the floating-point to. |
|
nodiscard |
Performs the mathematical absolute value operation.
|
nodiscard |
Performs the mathematical ceiling operation.
|
nodiscard |
Breaks a floating-point number into its whole and fractional components.
digits | The number of digits of precision to have in the fractional portion. |
|
nodiscard |
Performs the mathematical floor operation.
|
nodiscard |
Determines if the supplied number is equal to within a specific number of digits.
other | The other floating-point value to compare the current instance to. |
digits | The number of digits of precision to compare the two numbers to. |
|
nodiscard |
Calculates the modulo operation, i.e. division remainder.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
DomainError | When the result of the operation would result in a division by zero. |
divisor | The value to perform the modulo of the current stored value (dividend) with. |
|
nodiscard |
Calculates the multiplication operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
other | The value to multiply the current stored value with. |
FloatingPoint & pecunia::FloatingPoint::operator*= | ( | const FloatingPoint & | other | ) |
Calculates the multiplication and assignment operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
other | The value to multiply the current stored value with. |
|
nodiscard |
Calculates the addition operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
other | The value to add to the current stored value. |
FloatingPoint & pecunia::FloatingPoint::operator+= | ( | const FloatingPoint & | other | ) |
Calculates the addition and assignment operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
other | The value to add to the current stored value. |
|
nodiscard |
Negation operator.
|
nodiscard |
Calculates the subtraction operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
other | The value to subtract from the current stored value. |
FloatingPoint & pecunia::FloatingPoint::operator-= | ( | const FloatingPoint & | other | ) |
Calculates the subtraction and assignment operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
other | The value to subtract to the current stored value. |
|
nodiscard |
Calculates the division operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
DomainError | When the result of the operation would result in a division by zero. |
divisor | The value to divide the current stored value (dividend) with. |
FloatingPoint & pecunia::FloatingPoint::operator/= | ( | const FloatingPoint & | divisor | ) |
Calculates the division and assignment operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
DomainError | When the result of the operation would result in a division by zero. |
divisor | The value to divide the current stored value (dividend) with. |
|
nodiscardnoexcept |
Relationship operator checking the less-than status.
other | The value to check the relationship with the current value. |
|
nodiscardnoexcept |
Relationship operator checking the less-than status.
other | The value to check the relationship with the current value. |
|
delete |
|
delete |
|
delete |
|
delete |
|
nodiscardnoexcept |
Relationship operator checking the greater-than status.
other | The value to check the relationship with the current value. |
|
nodiscardnoexcept |
Relationship operator checking the greater-than status.
other | The value to check the relationship with the current value. |
|
delete |
|
delete |
|
nodiscard |
Performs the exponentiation operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
DomainError | When the result of the operation would result in a division by zero. |
exponent | The power to raise the base value to. |
|
nodiscard |
Performs the exponentiation operation.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
DomainError | When the result of the operation would result in a division by zero. |
exponent | The power to raise the base value to. |
|
nodiscard |
Calculates the reciprocal of the current instance's value.
OverflowError | When the result of the operation would result in an overflow. |
UnderflowError | When the result of the operation would result in an underflow. |
DomainError | When the result of the operation would result in a division by zero. |
|
nodiscard |
Calculates the square root of the stored value.
DomainError | When the result of the operation would be invalid. |
|
nodiscard |
Converts the float-point value into a string.
|
nodiscardnoexcept |
The unsafe type represented by the floating-point value.