OnixS EuroTLX MITCH Handler for C++  1.1.0.1
Public Member Functions | Static Public Member Functions | List of all members
Decimal Class Reference

Decimal type for better precision. More...

Public Member Functions

 Decimal (DecimalMantissa mantissa=0, DecimalExponent exponent=0)
 Initializes instance from compound components.
 
 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.
 
DecimalMantissa mantissa () const
 Returns mantissa part of decimal.
 
void mantissa (DecimalMantissa)
 Updates mantissa part of decimal.
 
DecimalExponent exponent () const
 Returns exponent part of decimal.
 
void exponent (DecimalExponent)
 Updates exponent part of decimal.
 
bool operator== (const Decimal &) const
 Compares two numbers.
 
bool operator!= (const Decimal &) const
 Compares two numbers.
 
 operator Int32 () 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 Int64 () 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 (Int32 &) 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 (Int64 &) 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.
 
std::string toString () const
 Returns text presentation of decimal.
 
Decimaloperator= (const Decimal &other)
 Reinitializes instance from another one.
 

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...
 

Detailed Description

Decimal type for better precision.

Constructor & Destructor Documentation

Decimal ( Double  value)
explicit

Converts from Double value using default conversion precision.

Decimal ( Double  value,
size_t  precision 
)

Converts Double value to decimal.

Parameters
valuedouble precision floating-point value.
precisiondefines conversion precision.

Member Function Documentation

operator Double ( ) const
inline

Casts to whole floating point as regular value is casted to a smaller precision.

Exceptions
domain_errorexception on failure.
operator Int32 ( ) const
inline

Casts to whole integer number as regular floating point value is casted.

Exceptions
domain_errorexception on failure.
operator Int64 ( ) const
inline

Casts to whole integer number as regular floating point value is casted.

Exceptions
domain_errorexception on failure.
operator UInt32 ( ) const
inline

Casts to whole integer number as regular floating point value is casted.

Exceptions
domain_errorexception on failure.
operator UInt64 ( ) const
inline

Casts to whole integer number as regular floating point value is casted.

Exceptions
domain_errorexception on failure.
static Decimal parse ( const char *  buffer,
size_t  bufferSize 
)
static

Parses decimal from string presentation.

Exceptions
std::exceptionon failure.
bool toNumber ( Int32 &  ) const

Casts to whole integer number as regular floating point value is casted.

Returns
false if conversion fails.
bool toNumber ( UInt32 &  ) const

Casts to whole integer number as regular floating point value is casted.

Returns
false if conversion fails.
bool toNumber ( Int64 &  ) const

Casts to whole integer number as regular floating point value is casted.

Returns
false if conversion fails.
bool toNumber ( UInt64 &  ) const

Casts to whole integer number as regular floating point value is casted.

Returns
false if conversion fails.
bool toNumber ( Double &  ) const

Casts to floating point number.

Returns
false if conversion fails.
static bool tryParse ( const char *  buffer,
size_t  bufferSize,
Decimal  
)
static

Attempts to parse decimal value from its string/text presentation.

Returns
false on parsing failure.