Decimal type for better precision. More...
Public Member Functions | |
Decimal () | |
Default constructor. More... | |
Decimal (DecimalMantissa mantissa, DecimalExponent exponent) | |
Initializes instance from compound components. More... | |
Decimal (SInt32 value) | |
Initializes instance with zero exponent. More... | |
Decimal (Double value) | |
Converts from Double value using default conversion precision. More... | |
Decimal (Double value, size_t precision) | |
Converts Double value to decimal. More... | |
Decimal (const Decimal &other) | |
Initializes as copy of given value. More... | |
DecimalMantissa | mantissa () const |
Returns mantissa part of decimal. More... | |
DecimalExponent | exponent () const |
Returns exponent part of decimal. More... | |
bool | operator== (const Decimal &) const |
Compares two numbers. More... | |
bool | operator!= (const Decimal &) const |
Compares two numbers. More... | |
operator SInt32 () const | |
Casts to whole integer number as regular floating point value is casted. More... | |
operator UInt32 () const | |
Casts to whole integer number as regular floating point value is casted. More... | |
operator SInt64 () const | |
Casts to whole integer number as regular floating point value is casted. More... | |
operator UInt64 () const | |
Casts to whole integer number as regular floating point value is casted. More... | |
operator Double () const | |
Casts to whole floating point as regular value is casted to a smaller precision. More... | |
bool | toNumber (SInt32 &) const |
Casts to whole integer number as regular floating point value is casted. More... | |
bool | toNumber (UInt32 &) const |
Casts to whole integer number as regular floating point value is casted. More... | |
bool | toNumber (SInt64 &) const |
Casts to whole integer number as regular floating point value is casted. More... | |
bool | toNumber (UInt64 &) const |
Casts to whole integer number as regular floating point value is casted. More... | |
bool | toNumber (Double &) const |
Casts to floating point number. More... | |
void | toString (std::string &) const |
Appends text presentation to given string. More... | |
std::string | toString () const |
Returns text presentation of decimal. More... | |
Decimal & | operator= (const Decimal &other) |
Reinitializes instance from another one. More... | |
Static Public Member Functions | |
static bool | tryParse (const char *buffer, size_t bufferSize, Decimal &) |
Attempts to parse decimal value from its string/text presentation. More... | |
static Decimal | parse (const char *buffer, size_t bufferSize) |
Parses decimal from string presentation. More... | |
Decimal type for better precision.
|
inline |
Default constructor.
Initializes the decimal value to zero.
Decimal | ( | DecimalMantissa | mantissa, |
DecimalExponent | exponent | ||
) |
Initializes instance from compound components.
|
explicit |
Initializes instance with zero exponent.
|
explicit |
Converts from Double value using default conversion precision.
Decimal | ( | Double | value, |
size_t | precision | ||
) |
Converts Double value to decimal.
value | double precision floating-point value. |
precision | defines conversion precision. |
|
inline |
Returns exponent part of decimal.
|
inline |
Returns mantissa part of decimal.
|
inline |
Casts to whole floating point as regular value is casted to a smaller precision.
domain_error | exception on failure. |
|
inline |
Casts to whole integer number as regular floating point value is casted.
domain_error | exception on failure. |
|
inline |
Casts to whole integer number as regular floating point value is casted.
domain_error | exception on failure. |
|
inline |
Casts to whole integer number as regular floating point value is casted.
domain_error | exception on failure. |
|
inline |
Casts to whole integer number as regular floating point value is casted.
domain_error | exception on failure. |
bool operator!= | ( | const Decimal & | ) | const |
Compares two numbers.
bool operator== | ( | const Decimal & | ) | const |
Compares two numbers.
|
static |
Parses decimal from string presentation.
std::exception | on failure. |
bool toNumber | ( | SInt32 & | ) | const |
Casts to whole integer number as regular floating point value is casted.
bool toNumber | ( | UInt32 & | ) | const |
Casts to whole integer number as regular floating point value is casted.
bool toNumber | ( | SInt64 & | ) | const |
Casts to whole integer number as regular floating point value is casted.
bool toNumber | ( | UInt64 & | ) | const |
Casts to whole integer number as regular floating point value is casted.
bool toNumber | ( | Double & | ) | const |
Casts to floating point number.
void toString | ( | std::string & | ) | const |
Appends text presentation to given string.
|
inline |
Returns text presentation of decimal.
|
static |
Attempts to parse decimal value from its string/text presentation.