Decimal (alias System.Decimal structure in BCL) is intended for storing monetary values. This is a 128-bit floating point decimal type (as opposed to binary floating point) and is useful for storing real-world values ββwith high decimal precision. In the real world, I mean measurements that were originally made in decimal form. Double is usually suitable for calculations that do not need such precision when they are represented as decimal numbers.
The decimal value type represents decimal numbers from positive 79,228,162,514,264,337,593,543,950,335 to negative 79,228,162,514,264,337,593,543,950,335. The type of decimal value is suitable for financial calculations requiring a large number of significant integral and fractional digits and rounding errors . The Decimal type does not eliminate the need for rounding. Rather, it minimizes round-off errors. For example, the following code produces the result 0.99999999999999999999999999999999, not 1.
Mehrdad afshari
source share