Decimal Value Type

Overview

The Decimal value type is appropriate for financial calculations requiring large numbers of significant integral and fractional digits and no round-off errors. The Decimal type does not eliminate the need for rounding. Rather, it minimizes errors due to rounding.

For more information refer to the Decimal Structure topic in MSDN.

Definition

A Decimal value type is defined in the following manner:

[ws][sign][integral-digits[,]]integral-digits[.[fractional-digits]}|.fractional-digits[ws]
Item Behaviour Description
ws Optional White space.
sign Optional Minus sign indicating a negative Decimal value.
integral-digits Required if
fractional-digits is not present
A series of digits ranging from 0 to 9 that specify the integral part of the number. Runs of integral-digits can be partitioned by a group-separator symbol.
, Optional A culture-specific thousands separator symbol.
. Optional A culture-specific decimal point symbol.
fractional-digits Optional A series of digits ranging from 0 to 9 that specify the fractional part of the number.

Predefined values

The following is a list of predefined Decimal values:

Default value 0
Minimum value -79,228,162,514,264,337,593,543,950,335
Maximum value 79,228,162,514,264,337,593,543,950,335

Configuration

A Decimal attribute value configuration has the following format:

<exampleElement exampleAttribute="123.456" />

For more information refer to the Decimal.Parse Method topic in MSDN.

Is this article helpful for you?