在VB.NET中存储货币值的最合适的数据类型是什么?
十进制(BCL中的别名为
原文链接:https://www.f2er.com/vb/255355.htmlSystem.Decimal
structure)用于存储货币值.它是128位十进制浮点类型(与二进制浮点相反),可用于存储具有高小数精度的“真实世界”值.通过现实世界,我特别指的是最初以十进制形式进行的测量. Double通常适用于在表示为十进制数时不需要那么多精度的计算.
The Decimal value type represents decimal numbers ranging from positive 79,228,162,514,264,337,593,543,950,335 to negative 79,335. 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 example,the following code produces a result of 0.9999999999999999999999999999 rather than 1.