C#中的数据类型 [英] data type in c#

查看:104
本文介绍了C#中的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

double具有64位大小
十进制具有128位大小
这也是为什么小数的范围小于双精度的原因.

解决方案

因为小数的精度大于双精度的精度.

十进制:28-29位有效数字
双精度:15-16位数字.

要获取更多信息,请在Visual Studio中选择关键字"double"或"decimal",然后按F1键.双精度指数较大.

就像可以容纳6位数字的整数和可以容纳3位数字(具有三位数的指数)的浮点数之间的区别.
整数的范围是0-999999,而浮点型是0-999E999.
虽然后者可以容纳更大的值,但前者可以更精确-浮动不能容纳999999,最接近的可以是999E3或999000,或者也许是1E6(1000000)


[edit]添加了1E6位-OriginalGriff [/edit]


double has 64 bit size
decimal has 128 bit size
then also why decimal has small range than double.

解决方案

Because the decimal have greater precision than the double.

decimal: 28-29 significant digits
double: 15-16 digits.

To get more information, select the keyword ''double'' or ''decimal'' in visual studio and hit key F1.


Because a decimal has more significant digits than a double, while a double has a larger exponent.

It''s like the difference between an integer that can hold 6 digits, and a float that can hold three, with a three digit exponent.
The range of the integer is 0 - 999999, while the float is 0 - 999E999.
While the later can hold larger values, the former is more accurate - the float can''t hold 999999, the closest it can come is 999E3, or 999000, or perhaps 1E6 (1000000)


[edit]Added the 1E6 bit - OriginalGriff[/edit]


这篇关于C#中的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆