Home  >  Article  >  Backend Development  >  C# Learning Diary 07---The decimal type of data type

C# Learning Diary 07---The decimal type of data type

黄舟
黄舟Original
2017-01-20 13:31:491914browse

Decimal type of value type:

C# specifically defines a decimal type (decimal) for us (previously, C/C++ did not have subtypes), which is mainly used in finance or currency. calculate. The decimal type is a high-precision, 128-bit data type that can retain 28 or 29 significant digits (double only has 15 or 16 digits, which has been tested in the previous article), although its value range is smaller than double There are more, but it is much more accurate than double.

When defining a decimal variable and assigning it a value, use the m subscript to indicate that it is a decimal type (because C# default decimal is double type);

For example: decimal value = 1.0m;

The above is the content of C# Learning Diary 07---the decimal type of data type. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn