Public Types

typedef Detail::decimal_number_type number_type
 An alias for Detail::decimal_number_type. More...
 

Public Member Functions

ASPOSECPP_SHARED_API Decimal ()
 Constructs an instance that represents 0. More...
 
ASPOSECPP_SHARED_API Decimal (std::int8_t i)
 
ASPOSECPP_SHARED_API Decimal (std::int16_t i)
 
ASPOSECPP_SHARED_API Decimal (std::int32_t i)
 
ASPOSECPP_SHARED_API Decimal (std::int64_t i)
 
ASPOSECPP_SHARED_API Decimal (std::uint8_t i)
 
ASPOSECPP_SHARED_API Decimal (std::uint16_t i)
 
ASPOSECPP_SHARED_API Decimal (std::uint32_t i)
 
ASPOSECPP_SHARED_API Decimal (std::uint64_t i)
 
ASPOSECPP_SHARED_API Decimal (float f)
 
ASPOSECPP_SHARED_API Decimal (double d)
 
ASPOSECPP_SHARED_API Decimal (const std::string &str)
 Constructs an instance that represents a value whose string representation is specified as an instance of std::string class. More...
 
ASPOSECPP_SHARED_API Decimal (int32_t lo, int32_t mid, int32_t hi, bool isNegative, uint8_t scale)
 
ASPOSECPP_SHARED_API Decimal (const Decimal &d)
 
ASPOSECPP_SHARED_API Decimal (const ArrayPtr< int32_t > &bits)
 
ASPOSECPP_SHARED_API Decimal (std::nullptr_t bits)
 Always throws ArgumentNullException. More...
 
ASPOSECPP_SHARED_API ~Decimal ()
 Destructor. More...
 
ASPOSECPP_SHARED_API Decimaloperator= (const Decimal &d)
 
ASPOSECPP_SHARED_API operator float () const
 Converts the value represented by the current object to single-precision floating-point value. More...
 
ASPOSECPP_SHARED_API operator double () const
 Converts the value represented by the current object to double-precision floating-point value. More...
 
ASPOSECPP_SHARED_API operator bool () const
 
ASPOSECPP_SHARED_API Decimal operator+ (const Decimal &d) const
 
ASPOSECPP_SHARED_API Decimal operator- (const Decimal &d) const
 
ASPOSECPP_SHARED_API Decimal operator* (const Decimal &d) const
 
ASPOSECPP_SHARED_API Decimal operator/ (const Decimal &d) const
 
ASPOSECPP_SHARED_API Decimal operator% (const Decimal &d) const
 
ASPOSECPP_SHARED_API Decimal operator- () const
 Returns a new instance of Decimal class that represents a value that results from negation of the value represented by the current object. More...
 
ASPOSECPP_SHARED_API bool operator== (const Decimal &d) const
 
ASPOSECPP_SHARED_API bool operator!= (const Decimal &d) const
 
ASPOSECPP_SHARED_API bool operator== (std::nullptr_t) const
 
ASPOSECPP_SHARED_API bool operator!= (std::nullptr_t) const
 
ASPOSECPP_SHARED_API bool operator< (const Decimal &d) const
 
ASPOSECPP_SHARED_API bool operator<= (const Decimal &d) const
 
ASPOSECPP_SHARED_API bool operator> (const Decimal &d) const
 
ASPOSECPP_SHARED_API bool operator>= (const Decimal &d) const
 
ASPOSECPP_SHARED_API Decimaloperator++ ()
 
ASPOSECPP_SHARED_API Decimaloperator-- ()
 
ASPOSECPP_SHARED_API Decimaloperator+= (const Decimal &d)
 
ASPOSECPP_SHARED_API Decimaloperator-= (const Decimal &d)
 
ASPOSECPP_SHARED_API Decimaloperator*= (const Decimal &d)
 
ASPOSECPP_SHARED_API Decimaloperator/= (const Decimal &d)
 
ASPOSECPP_SHARED_API Decimaloperator%= (const Decimal &d)
 
ASPOSECPP_SHARED_API bool Equals (const Decimal &d) const
 
ASPOSECPP_SHARED_API bool Equals (const SharedPtr< Object > &obj) const
 
ASPOSECPP_SHARED_API int CompareTo (const Decimal &d) const
 
ASPOSECPP_SHARED_API int GetHashCode () const
 Returns a hash code for the current object. More...
 
ASPOSECPP_SHARED_API String ToString () const
 Returns the string representation of the value represented by the object. More...
 
ASPOSECPP_SHARED_API String ToString (const SharedPtr< IFormatProvider > &provider) const
 
ASPOSECPP_SHARED_API String ToString (const SharedPtr< Globalization::CultureInfo > &culture) const
 
ASPOSECPP_SHARED_API String ToString (const SharedPtr< Globalization::NumberFormatInfo > &nfi) const
 
String ToString (const Decimal &value, std::nullptr_t) const
 
ASPOSECPP_SHARED_API String ToString (const String &format, const SharedPtr< IFormatProvider > &provider) const
 
ASPOSECPP_SHARED_API String ToString (const String &format, const SharedPtr< Globalization::CultureInfo > &culture) const
 
ASPOSECPP_SHARED_API String ToString (const String &format, const SharedPtr< Globalization::NumberFormatInfo > &nfi) const
 
ASPOSECPP_SHARED_API String ToString (const String &format, std::nullptr_t=nullptr) const
 
ASPOSECPP_SHARED_API std::string ToStdString () const
 Returns an instance of std::string that contains the string representation of the value represented by the object. More...
 
ASPOSECPP_SHARED_API Decimal (const number_type &value)
 
TypeCode GetTypeCode () const
 Gets object type code. More...
 
String ToStringInternal () const
 Returns the string representation of the value represented by the object. For internal use. More...
 

Static Public Member Functions

static ASPOSECPP_SHARED_API Decimal Round (const Decimal &d, MidpointRounding mode=MidpointRounding::ToEven)
 
static ASPOSECPP_SHARED_API Decimal Round (const Decimal &d, int digits, MidpointRounding mode=MidpointRounding::ToEven)
 
static ASPOSECPP_SHARED_API Decimal Truncate (const Decimal &d)
 
static ASPOSECPP_SHARED_API Decimal Ceiling (const Decimal &d)
 
static ASPOSECPP_SHARED_API Decimal Floor (const Decimal &d)
 
static bool Equals (const Decimal &d1, const Decimal &d2)
 
static int Compare (const Decimal &d1, const Decimal &d2)
 
static ASPOSECPP_SHARED_API Decimal Parse (const String &s)
 
static ASPOSECPP_SHARED_API Decimal Parse (const String &s, Globalization::NumberStyles styles)
 
static ASPOSECPP_SHARED_API Decimal Parse (const String &s, const SharedPtr< IFormatProvider > &provider)
 
static ASPOSECPP_SHARED_API Decimal Parse (const String &s, Globalization::NumberStyles styles, const SharedPtr< IFormatProvider > &provider)
 
static ASPOSECPP_SHARED_API bool TryParse (const String &value, Decimal &result)
 
static ASPOSECPP_SHARED_API bool TryParse (const String &value, Globalization::NumberStyles styles, const SharedPtr< IFormatProvider > &provider, Decimal &result)
 
static const TypeInfoType ()
 Returns a reference to the TypeInfo object representing the Decimal class' type information. More...
 
static ASPOSECPP_SHARED_API System::ArrayPtr< int > GetBits (const Decimal &d)
 
static ASPOSECPP_SHARED_API void GetBytes (const Decimal &value, const System::ArrayPtr< uint8_t > &buffer)
 
static ASPOSECPP_SHARED_API int64_t ToOACurrency (const Decimal &value)
 
static ASPOSECPP_SHARED_API Decimal FromOACurrency (int64_t currency)
 
static Decimal Add (const Decimal &d1, const Decimal &d2)
 
static Decimal Subtract (const Decimal &d1, const Decimal &d2)
 
static Decimal Divide (const Decimal &d1, const Decimal &d2)
 
static Decimal Remainder (const Decimal &d1, const Decimal &d2)
 
static Decimal Multiply (const Decimal &d1, const Decimal &d2)
 
static Decimal Negate (const Decimal &d)
 Returns a new instance of Decimal class that represents a value that results from negation of the value represented by the specified object. More...
 
static uint8_t ToByte (Decimal value)
 Converts the Decimal value to unsigned 8-bit integer value. More...
 
static int8_t ToSByte (Decimal value)
 Converts the Decimal value to signed 8-bit integer value. More...
 
static uint16_t ToUInt16 (Decimal value)
 Converts the Decimal value to unsigned 16-bit integer value. More...
 
static int16_t ToInt16 (Decimal value)
 Converts the Decimal value to signed 16-bit integer value. More...
 
static uint32_t ToUInt32 (Decimal value)
 Converts the Decimal value to unsigned 32-bit integer value. More...
 
static int32_t ToInt32 (Decimal value)
 Converts the Decimal value to signed 32-bit integer value. More...
 
static uint64_t ToUInt64 (Decimal value)
 Converts the Decimal value to unsigned 64-bit integer value. More...
 
static int64_t ToInt64 (Decimal value)
 Converts the Decimal value to signed 64-bit integer value. More...
 
static float ToSingle (Decimal value)
 Converts the Decimal value to single precision floating-point number. More...
 
static double ToDouble (Decimal value)
 Converts the Decimal value to double precision floating-point number. More...
 

Static Public Attributes

static const Decimal ASPOSECPP_SHARED_API MaxValue
 Represents the largest number that can be represented by Decimal class. More...
 
static const Decimal ASPOSECPP_SHARED_API MinValue
 Represents the smallest number that can be represented by Decimal class. More...
 
static const Decimal ASPOSECPP_SHARED_API MinusOne
 Represents number -1. More...
 
static const Decimal ASPOSECPP_SHARED_API One
 Represents number 1. More...
 
static const Decimal ASPOSECPP_SHARED_API Zero
 Represents number 0. More...
 

Detailed Description

Represents a decimal number. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

#include "system/console.h"
#include "system/decimal.h"
int main()
{
using namespace System;
auto dividend = Decimal::One;
auto divisor = 6;
Console::WriteLine(dividend/divisor);
return 0;
}
/*
* This code example produces the following output:
* -79228162514264337593543950335
* 79228162514264337593543950335
* 0,1666666666666666666666666667
*/

Member Typedef Documentation

◆ number_type

typedef Detail::decimal_number_type System::Decimal::number_type

An alias for Detail::decimal_number_type.

Constructor & Destructor Documentation

◆ Decimal() [1/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( )

Constructs an instance that represents 0.

◆ Decimal() [2/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::int8_t  i)

Constructs an instance that represents the specified value.

Parameters
i8-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [3/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::int16_t  i)

Constructs an instance that represents the specified value.

Parameters
i16-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [4/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::int32_t  i)

Constructs an instance that represents the specified value.

Parameters
i32-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [5/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::int64_t  i)

Constructs an instance that represents the specified value.

Parameters
i64-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [6/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::uint8_t  i)

Constructs an instance that represents the specified value.

Parameters
iunsigned 8-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [7/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::uint16_t  i)

Constructs an instance that represents the specified value.

Parameters
iunsigned 16-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [8/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::uint32_t  i)

Constructs an instance that represents the specified value.

Parameters
iunsigned 32-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [9/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::uint64_t  i)

Constructs an instance that represents the specified value.

Parameters
iunsigned 64-bit integer value to be represented by the Decimal object being constructed

◆ Decimal() [10/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( float  f)

Constructs an instance that represents the specified value.

Parameters
fThe single-precision floating-point value to be represented by the Decimal object being constructed

◆ Decimal() [11/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( double  d)

Constructs an instance that represents the specified value.

Parameters
dThe double-precision floating-point value to be represented by the Decimal object being constructed

◆ Decimal() [12/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( const std::string &  str)
explicit

Constructs an instance that represents a value whose string representation is specified as an instance of std::string class.

◆ Decimal() [13/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( int32_t  lo,
int32_t  mid,
int32_t  hi,
bool  isNegative,
uint8_t  scale 
)

Constructs a Decimal object from the specified from the specified components.

Parameters
loThe low 32 bits of the value
midThe middle 32 bits of the value
hiThe high 32 bits of the value
isNegativeSpecifies if the value is negative
scaleA power of 10 ranging from 0 to 28

◆ Decimal() [14/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( const Decimal d)

Constructs an instance of Decimal class that represents the same number as the specified Decimal object.

Parameters
dA Decimal object to copy the value from

◆ Decimal() [15/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( const ArrayPtr< int32_t > &  bits)

Constructs an instance of Decimal class from integer array containing a binary representation.

Parameters
bitsA integer array containing a binary representation.

◆ Decimal() [16/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( std::nullptr_t  bits)

Always throws ArgumentNullException.

◆ ~Decimal()

ASPOSECPP_SHARED_API System::Decimal::~Decimal ( )

Destructor.

◆ Decimal() [17/17]

ASPOSECPP_SHARED_API System::Decimal::Decimal ( const number_type value)

Constructs an instance of Decimal class representing the specified value.

Parameters
valueA constant reference to the value to be represented by the object being constructed

Member Function Documentation

◆ Add()

static Decimal System::Decimal::Add ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Adds two specified Decimal values.

Parameters
d1First value.
d2Second value.
Returns
The sum of d1 and d2.

◆ Ceiling()

static ASPOSECPP_SHARED_API Decimal System::Decimal::Ceiling ( const Decimal d)
static

Returns the smallest integral value that is greater than or equal to the specified value.

Parameters
dA decimal number
Returns
The smallest integral value that is greater than or equal to d

◆ Compare()

static int System::Decimal::Compare ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Determines if the value represented by the first Decimal object is less than, equal to or greater than the value represented by the second Decimal object.

Parameters
d1The first comparand
d2The second comparand
Returns
-1 if the value represented by d1 is less than the value represented by d2; 0 if the values are equal; 1 if the value represented by d1 is greater than the value represented by d2

◆ CompareTo()

ASPOSECPP_SHARED_API int System::Decimal::CompareTo ( const Decimal d) const

Determines if the value represented by the current object is less than, equal to or greater than the value represented by the specified object.

Parameters
dThe comparand
Returns
-1 if the value represented by the current object is less than the value represented by d; 0 if the values are equal; 1 if the value represented by the current object is greater than the value represented by d

◆ Divide()

static Decimal System::Decimal::Divide ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Divides two specified Decimal values.

Parameters
d1The dividend.
d2The divisor.
Returns
The result of dividing d1 by d2.

◆ Equals() [1/3]

ASPOSECPP_SHARED_API bool System::Decimal::Equals ( const Decimal d) const

Determines if the values represented by the current object and the specified object are equal.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current and the specified objects are equal, otherwise - false

◆ Equals() [2/3]

ASPOSECPP_SHARED_API bool System::Decimal::Equals ( const SharedPtr< Object > &  obj) const

Determines if the values represented by the current object and the specified object are equal.

Parameters
objThe object to compare the current object with
Returns
True if the value represented by the current and the specified objects are equal, otherwise - false

◆ Equals() [3/3]

static bool System::Decimal::Equals ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Determines if the values represented by the specified objects are equal.

Parameters
d1The first comparand
d2The second comparand
Returns
True if the values represented by d1 and d2 are equal, otherwise - false

◆ Floor()

static ASPOSECPP_SHARED_API Decimal System::Decimal::Floor ( const Decimal d)
static

Returns the largest integral value that is less than or equal to the specified value.

Parameters
dA decimal number
Returns
The largest integral value that is less than or equal to d

◆ FromOACurrency()

static ASPOSECPP_SHARED_API Decimal System::Decimal::FromOACurrency ( int64_t  currency)
static

Convert the specified OLE currency value to the equivalent Decimal value. NOT IMPLEMENTED.

◆ GetBits()

static ASPOSECPP_SHARED_API System::ArrayPtr<int> System::Decimal::GetBits ( const Decimal d)
static

Converts the specified Decimal object into the binary representation of the value it represents.

Parameters
dThe Decimal object to convert
Returns
An array whose elements represent distinct bits of the binary representation of the value represented by d

◆ GetBytes()

static ASPOSECPP_SHARED_API void System::Decimal::GetBytes ( const Decimal value,
const System::ArrayPtr< uint8_t > &  buffer 
)
static

Convert the specified Decimal value to an array of bytes.

Parameters
valueThe Decimal value to convert
bufferThe output parameter that, if the conversion succeeds, contains the result of conversion when the method returns.

◆ GetHashCode()

ASPOSECPP_SHARED_API int System::Decimal::GetHashCode ( ) const

Returns a hash code for the current object.

◆ GetTypeCode()

TypeCode System::Decimal::GetTypeCode ( ) const
inline

Gets object type code.

◆ Multiply()

static Decimal System::Decimal::Multiply ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Multiplies two specified Decimal values.

Parameters
d1The multiplicand.
d2The multiplier.
Returns
The result of multiplying d1 and d2.

◆ Negate()

static Decimal System::Decimal::Negate ( const Decimal d)
inlinestatic

Returns a new instance of Decimal class that represents a value that results from negation of the value represented by the specified object.

◆ operator bool()

ASPOSECPP_SHARED_API System::Decimal::operator bool ( ) const
explicit

Converts the value represented by the current object to a boolean value.

Returns
True if the value represented by the current object is not 0, otherwise - false

◆ operator double()

ASPOSECPP_SHARED_API System::Decimal::operator double ( ) const
explicit

Converts the value represented by the current object to double-precision floating-point value.

◆ operator float()

ASPOSECPP_SHARED_API System::Decimal::operator float ( ) const
explicit

Converts the value represented by the current object to single-precision floating-point value.

◆ operator!=() [1/2]

ASPOSECPP_SHARED_API bool System::Decimal::operator!= ( const Decimal d) const

Determines if the values represented by the current object and the specified object are not equal.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current and the specified objects are not equal, otherwise - false

◆ operator!=() [2/2]

ASPOSECPP_SHARED_API bool System::Decimal::operator!= ( std::nullptr_t  ) const

Determines if the value represented by the current object is different from 0.

Returns
True if the value represented by the current object is different from 0, otherwise - false

◆ operator%()

ASPOSECPP_SHARED_API Decimal System::Decimal::operator% ( const Decimal d) const

Returns a new instance of Decimal class that represents a value that is a result of modulo operation with the values represented by the current and the specified objects.

Parameters
dThe Decimal object representing the divisor
Returns
A new instance of Decimal class that represents a value that is a result of modulo operation with the values represented by the current and the specified objects.

◆ operator%=()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator%= ( const Decimal d)

Assigns to the current object a new value that is the result of modulo operation with the values represented by the current and the specified objects.

Parameters
dThe Decimal object representing the divisor
Returns
A reference to the self

◆ operator*()

ASPOSECPP_SHARED_API Decimal System::Decimal::operator* ( const Decimal d) const

Returns a new instance of Decimal class that represents a value that is a result of multiplication of values represented by the current and specified objects.

Parameters
dThe Decimal object representing the multiplier
Returns
A new instance of Decimal class that represents a value that is a result of multiplication of values represented by the current and specified objects

◆ operator*=()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator*= ( const Decimal d)

Assigns to the current object a new value that is the result of multiplication of values represented by the current and specified objects.

Parameters
dThe Decimal object representing the multiplier
Returns
A reference to the self

◆ operator+()

ASPOSECPP_SHARED_API Decimal System::Decimal::operator+ ( const Decimal d) const

Returns a new instance of Decimal class that represents a value that is a sum of values represented by the current and specified objects.

Parameters
dThe Decimal object representing the value to add
Returns
A new instance of Decimal class that represents a value that is a sum of values represented by the current and specified objects

◆ operator++()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator++ ( )

Increments the value represented by the current object.

Returns
The reference to the self

◆ operator+=()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator+= ( const Decimal d)

Assigns to the current object a new value that is a sum of values represented by the current and specified objects.

Parameters
dThe Decimal object representing the value to add
Returns
A reference to the self

◆ operator-() [1/2]

ASPOSECPP_SHARED_API Decimal System::Decimal::operator- ( const Decimal d) const

Returns a new instance of Decimal class that represents a value that is the result of subtraction of the value represented by the specified object from the value represented by the current object.

Parameters
dThe Decimal object representing the value to subtract
Returns
A new instance of Decimal class that represents a value that is the result of subtraction of the value represented by the specified object from the value represented by the current object

◆ operator-() [2/2]

ASPOSECPP_SHARED_API Decimal System::Decimal::operator- ( ) const

Returns a new instance of Decimal class that represents a value that results from negation of the value represented by the current object.

◆ operator--()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator-- ( )

Decrements the value represented by the current object.

Returns
The reference to the self

◆ operator-=()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator-= ( const Decimal d)

Assigns to the current object a new value that is the result of subtraction of the value represented by the specified object from the value represented by the current object.

Parameters
dThe Decimal object representing the value to subtract
Returns
A reference to the self

◆ operator/()

ASPOSECPP_SHARED_API Decimal System::Decimal::operator/ ( const Decimal d) const

Returns a new instance of Decimal class that represents a value that is a result of division of the value represented by the current object by the value represented by the specified object.

Parameters
dThe Decimal object representing the divisor
Returns
A new instance of Decimal class that represents a value that is a result of division of the value represented by the current object by the value represented by the specified object.

◆ operator/=()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator/= ( const Decimal d)

Assigns to the current object a new value that is the result of division of the value represented by the current object by the value represented by the specified object.

Parameters
dThe Decimal object representing the divisor
Returns
A reference to the self

◆ operator<()

ASPOSECPP_SHARED_API bool System::Decimal::operator< ( const Decimal d) const

Determines if the value represented by the current object is less than the value represented by the specified object.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current object is less than the value represented by d, otherwise - false

◆ operator<=()

ASPOSECPP_SHARED_API bool System::Decimal::operator<= ( const Decimal d) const

Determines if the value represented by the current object is less than or equal to the value represented by the specified object.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current object is less than or equal to the value represented by d, otherwise - false

◆ operator=()

ASPOSECPP_SHARED_API Decimal& System::Decimal::operator= ( const Decimal d)

Assigns the value represented by the specified object to the current object.

Parameters
dDecimal object to copy the value from
Returns
The reference to the self

◆ operator==() [1/2]

ASPOSECPP_SHARED_API bool System::Decimal::operator== ( const Decimal d) const

Determines if the values represented by the current object and the specified object are equal.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current and the specified objects are equal, otherwise - false

◆ operator==() [2/2]

ASPOSECPP_SHARED_API bool System::Decimal::operator== ( std::nullptr_t  ) const

Determines if the value represented by the current object is 0.

Returns
True if the value represented by the current object is 0, otherwise - false

◆ operator>()

ASPOSECPP_SHARED_API bool System::Decimal::operator> ( const Decimal d) const

Determines if the value represented by the current object is greater than the value represented by the specified object.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current object is greater than the value represented by d, otherwise - false

◆ operator>=()

ASPOSECPP_SHARED_API bool System::Decimal::operator>= ( const Decimal d) const

Determines if the value represented by the current object is greater than or equal to the value represented by the specified object.

Parameters
dThe Decimal object to compare the current object with
Returns
True if the value represented by the current object is greater than or equal to the value represented by d, otherwise - false

◆ Parse() [1/4]

static ASPOSECPP_SHARED_API Decimal System::Decimal::Parse ( const String s)
static

Converts the string representation of a decimal number into an equivalent instance of Decimal class.

Parameters
sThe string representation of a number
Returns
A new instance of Decimal class representing a value equivalent to that represented by the specified string.

◆ Parse() [2/4]

static ASPOSECPP_SHARED_API Decimal System::Decimal::Parse ( const String s,
Globalization::NumberStyles  styles 
)
static

Converts the string representation of a decimal number into an equivalent instance of Decimal class using the specified style.

Parameters
sThe string representation of a decimal value to convert
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a Decimal object
Returns
A new instance of Decimal class representing a value equivalent to that represented by the specified string

◆ Parse() [3/4]

static ASPOSECPP_SHARED_API Decimal System::Decimal::Parse ( const String s,
const SharedPtr< IFormatProvider > &  provider 
)
static

Converts the string representation of a decimal number into an equivalent instance of Decimal class using the specified format provider.

Parameters
sThe string representation of a decimal value to convert
providerFormat provider
Returns
A new instance of Decimal class representing a value equivalent to that represented by the specified string

◆ Parse() [4/4]

static ASPOSECPP_SHARED_API Decimal System::Decimal::Parse ( const String s,
Globalization::NumberStyles  styles,
const SharedPtr< IFormatProvider > &  provider 
)
static

Converts the string representation of a decimal number into an equivalent instance of Decimal class using the specified style and format provider.

Parameters
sThe string representation of a decimal value to convert
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a Decimal object
providerFormat provider
Returns
A new instance of Decimal class representing a value equivalent to that represented by the specified string

◆ Remainder()

static Decimal System::Decimal::Remainder ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Computes the remainder after dividing two Decimal values.

Parameters
d1The dividend.
d2The divisor.
Returns
The remainder after dividing d1 by d2.

◆ Round() [1/2]

static ASPOSECPP_SHARED_API Decimal System::Decimal::Round ( const Decimal d,
MidpointRounding  mode = MidpointRounding::ToEven 
)
static

Rounds the specified value to the nearest integral number. A parameter specifies the function's behavior if the specified value is equally close to two nearest numbers.

Parameters
dThe value to round
modeSpecifies how to perform the rounding if value is equally close to two nearest numbers.
Returns
d rounded to the nearest integral value

◆ Round() [2/2]

static ASPOSECPP_SHARED_API Decimal System::Decimal::Round ( const Decimal d,
int  digits,
MidpointRounding  mode = MidpointRounding::ToEven 
)
static

Rounds the specified value to the nearest value with the specified number of fractional digits. A parameter specifies the function's behavior if the specified value is equally close to two nearest numbers.

Parameters
dThe value to round
digitsThe number of fractional digits in the rounded value
modeSpecifies how to perform the rounding if value is equally close to two nearest numbers.
Returns
The number with the specified number of digits nearest to value

◆ Subtract()

static Decimal System::Decimal::Subtract ( const Decimal d1,
const Decimal d2 
)
inlinestatic

Subtracts one specified Decimal value from another.

Parameters
d1The minuend.
d2The subtrahend.
Returns
The result of subtracting d2 from d1.

◆ ToByte()

static uint8_t System::Decimal::ToByte ( Decimal  value)
inlinestatic

Converts the Decimal value to unsigned 8-bit integer value.

◆ ToDouble()

static double System::Decimal::ToDouble ( Decimal  value)
inlinestatic

Converts the Decimal value to double precision floating-point number.

◆ ToInt16()

static int16_t System::Decimal::ToInt16 ( Decimal  value)
inlinestatic

Converts the Decimal value to signed 16-bit integer value.

◆ ToInt32()

static int32_t System::Decimal::ToInt32 ( Decimal  value)
inlinestatic

Converts the Decimal value to signed 32-bit integer value.

◆ ToInt64()

static int64_t System::Decimal::ToInt64 ( Decimal  value)
inlinestatic

Converts the Decimal value to signed 64-bit integer value.

◆ ToOACurrency()

static ASPOSECPP_SHARED_API int64_t System::Decimal::ToOACurrency ( const Decimal value)
static

Convert the specified Decimal value to the equivalent OLE currency value. NOT IMPLEMENTED.

◆ ToSByte()

static int8_t System::Decimal::ToSByte ( Decimal  value)
inlinestatic

Converts the Decimal value to signed 8-bit integer value.

◆ ToSingle()

static float System::Decimal::ToSingle ( Decimal  value)
inlinestatic

Converts the Decimal value to single precision floating-point number.

◆ ToStdString()

ASPOSECPP_SHARED_API std::string System::Decimal::ToStdString ( ) const

Returns an instance of std::string that contains the string representation of the value represented by the object.

◆ ToString() [1/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( ) const

Returns the string representation of the value represented by the object.

◆ ToString() [2/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const SharedPtr< IFormatProvider > &  provider) const

Converts current object to string using the culture-specific format information.

Parameters
providerThe IFormatProvider object providing the culture-specific format information.
Returns
The string representation of the current object.

◆ ToString() [3/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const SharedPtr< Globalization::CultureInfo > &  culture) const

◆ ToString() [4/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const SharedPtr< Globalization::NumberFormatInfo > &  nfi) const

◆ ToString() [5/9]

String System::Decimal::ToString ( const Decimal value,
std::nullptr_t   
) const
inline

◆ ToString() [6/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const String format,
const SharedPtr< IFormatProvider > &  provider 
) const

Converts current object to its string representation using the specified string format and culture-specific format information provided by the specified IFormatProvider object.

Parameters
formatThe string format.
providerThe IFormatProvider object providing the culture-specific format information.
Returns
The string representation of the current object.

◆ ToString() [7/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const String format,
const SharedPtr< Globalization::CultureInfo > &  culture 
) const

◆ ToString() [8/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const String format,
const SharedPtr< Globalization::NumberFormatInfo > &  nfi 
) const

◆ ToString() [9/9]

ASPOSECPP_SHARED_API String System::Decimal::ToString ( const String format,
std::nullptr_t  = nullptr 
) const

◆ ToStringInternal()

String System::Decimal::ToStringInternal ( ) const

Returns the string representation of the value represented by the object. For internal use.

◆ ToUInt16()

static uint16_t System::Decimal::ToUInt16 ( Decimal  value)
inlinestatic

Converts the Decimal value to unsigned 16-bit integer value.

◆ ToUInt32()

static uint32_t System::Decimal::ToUInt32 ( Decimal  value)
inlinestatic

Converts the Decimal value to unsigned 32-bit integer value.

◆ ToUInt64()

static uint64_t System::Decimal::ToUInt64 ( Decimal  value)
inlinestatic

Converts the Decimal value to unsigned 64-bit integer value.

◆ Truncate()

static ASPOSECPP_SHARED_API Decimal System::Decimal::Truncate ( const Decimal d)
static

Returns the Decimal object representing a value that has integral part equal to that of the value represented by the specified Decimal object of the with all fractional digits discarded.

Parameters
dA decimal number
Returns
A Decimal object representing a decimal value whose integral part is equal to that of the specified value and fractional digits are all 0.

◆ TryParse() [1/2]

static ASPOSECPP_SHARED_API bool System::Decimal::TryParse ( const String value,
Decimal result 
)
static

Converts the specified string containing the string representation of a number to the equivalent Decimal value.

Parameters
valueThe string to convert
resultThe reference to a Decimal variable where the result of the conversion is put
Returns
True if the conversion succeeded, otherwise - false

◆ TryParse() [2/2]

static ASPOSECPP_SHARED_API bool System::Decimal::TryParse ( const String value,
Globalization::NumberStyles  styles,
const SharedPtr< IFormatProvider > &  provider,
Decimal result 
)
static

Converts the specified string containing the string representation of a number to the equivalent Decimal value using the provided formatting information and number style.

Parameters
valueThe string to convert
stylesA bitwise combination of values of NumberStyles enum that specifies the permitted style of the string representation of a number
providerA pointer to an object that contains the string format information
resultAn output argument; contains the result of conversion
Returns
True if the conversion succeeded, otherwise - false

◆ Type()

static const TypeInfo& System::Decimal::Type ( )
inlinestatic

Returns a reference to the TypeInfo object representing the Decimal class' type information.

Member Data Documentation

◆ MaxValue

const Decimal ASPOSECPP_SHARED_API System::Decimal::MaxValue
static

Represents the largest number that can be represented by Decimal class.

◆ MinusOne

const Decimal ASPOSECPP_SHARED_API System::Decimal::MinusOne
static

Represents number -1.

◆ MinValue

const Decimal ASPOSECPP_SHARED_API System::Decimal::MinValue
static

Represents the smallest number that can be represented by Decimal class.

◆ One

const Decimal ASPOSECPP_SHARED_API System::Decimal::One
static

Represents number 1.

◆ Zero

const Decimal ASPOSECPP_SHARED_API System::Decimal::Zero
static

Represents number 0.