当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > .NET数值类型的精度

ASP.NET
如何用Response.Redirect方法传递汉字
在ASP.NET中调用存储过程方法新解
决定何时使用 DataGrid、DataList 或 Repeater(ASP.NET 技术文章)
AlternatingItemTemplate类似于 ItemTemplate 元素
c#中过滤html的正则表达式
ASP.NET:ADO.NET的DataAdapter对象
repeater分页 内容显示
内容添加asp.net
VS2003 SP1发布
DataReader深入解析:持续更新
C#.Net 学习笔记(一)
从ASP过渡到ASP.net遗留的二十大积习
如何改变asp.net项目名称
asp,asp.net学习教程下载
基于.net开发的遵循web标准的个人站点程序包下载
FileUpload1 上传文件类型验证正则表达式
ASP.NET与数据库相关技巧
读取TXT文件内容的方法
简单的启动窗体
c#中实现文件拖放打开的方法

ASP.NET 中的 .NET数值类型的精度


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 158 ::
收藏到网摘: n/a


float类型占32bit空间,只有7位精度,下面的程序
public class FloatPrecision
{
public static void Main()
{
Console.WriteLine((int)123456789F);
}
}
输出结果为123456792.
double占64bit空间,15~16位精度,下面的程序
public class DoublePrecision
{
public static void Main()
{
Console.WriteLine((long)123456789012345678D);
}
}
输出结果为123456789012345680
decimal占128bit空间,28位精度,MSDN中描述如下:
This type is useful for applications (such as accounting) where rounding errors must be avoided.