OnixS C++ Tradeweb Approved Publication Arrangement (APA) Handler  1.2.2.18
API documentation
Decimal Class Reference

#include <Decimal.h>

Public Member Functions

 Decimal ()
 
 Decimal (DecimalMantissa mantissa, DecimalExponent exponent)
 
 Decimal (SInt32 value)
 
 Decimal (Double value)
 
 Decimal (Double value, size_t precision)
 
 Decimal (const Decimal &other)
 
DecimalMantissa mantissa () const
 
DecimalExponent exponent () const
 
bool operator== (const Decimal &) const
 
bool operator!= (const Decimal &) const
 
 operator SInt32 () const
 
 operator UInt32 () const
 
 operator SInt64 () const
 
 operator UInt64 () const
 
 operator Double () const
 
bool toNumber (SInt32 &) const
 
bool toNumber (UInt32 &) const
 
bool toNumber (SInt64 &) const
 
bool toNumber (UInt64 &) const
 
bool toNumber (Double &) const
 
void toString (std::string &) const
 
std::string toString () const
 
Decimaloperator= (const Decimal &other)
 

Static Public Member Functions

static bool tryParse (const char *buffer, size_t bufferSize, Decimal &)
 
static Decimal parse (const char *buffer, size_t bufferSize)
 

Detailed Description

Decimal type for better precision.

Definition at line 42 of file Decimal.h.

Constructor & Destructor Documentation

Decimal ( )
inline

Default constructor. Initializes the decimal value to zero.

Definition at line 176 of file Decimal.h.

Decimal ( DecimalMantissa  mantissa,
DecimalExponent  exponent 
)

Initializes instance from compound components.

Decimal ( SInt32  value)
explicit

Initializes instance with zero exponent.

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.
Decimal ( const Decimal other)

Initializes as copy of given value.

Member Function Documentation

DecimalExponent exponent ( ) const
inline

Returns exponent part of decimal.

Definition at line 187 of file Decimal.h.

DecimalMantissa mantissa ( ) const
inline

Returns mantissa part of decimal.

Definition at line 182 of file Decimal.h.

operator Double ( ) const
inline

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

Exceptions
domain_errorexception on failure.

Definition at line 232 of file Decimal.h.

operator SInt32 ( ) const
inline

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

Exceptions
domain_errorexception on failure.

Definition at line 192 of file Decimal.h.

operator SInt64 ( ) const
inline

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

Exceptions
domain_errorexception on failure.

Definition at line 212 of file Decimal.h.

operator UInt32 ( ) const
inline

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

Exceptions
domain_errorexception on failure.

Definition at line 202 of file Decimal.h.

operator UInt64 ( ) const
inline

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

Exceptions
domain_errorexception on failure.

Definition at line 222 of file Decimal.h.

bool operator!= ( const Decimal ) const

Compares two numbers.

Decimal& operator= ( const Decimal other)

Reinitializes instance from another one.

bool operator== ( const Decimal ) const

Compares two numbers.

static Decimal parse ( const char *  buffer,
size_t  bufferSize 
)
static

Parses decimal from string presentation.

Exceptions
std::exceptionon failure.
bool toNumber ( SInt32 ) 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 ( SInt64 ) 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.
void toString ( std::string &  ) const

Appends text presentation to given string.

std::string toString ( ) const
inline

Returns text presentation of decimal.

Definition at line 242 of file Decimal.h.

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.

The documentation for this class was generated from the following file: