C#中对于float,double,decimal的区别
2011-03-07 17:18
495 查看
float 单精度浮点 32bit,double 双精度浮点64bit
decimal是高精度 128bit,是不是浮点不是很清楚。
他们都有精度问题, 多数情况用decimal即可
float、float是primitive type
decimal不是 primitive type
注:
As Jeffrey Richter said, primitive types are any data type the compiler directly supports. In C#。
枚举只能用Primitive类型。
enum Flag : Int32 {},编译器就会报错,错误信息仅仅是“应输入类型 byte、sbyte、short、ushort、int、uint、long 或 ulong”
refence:
http://www.cnblogs.com/gf7788/archive/2009/07/24/1529848.html http://www.cnblogs.com/LeimOO/archive/2009/10/12/1581915.html http://msdn.microsoft.com/zh-cn/library/364x0z75%28VS.80%29.aspx http://www.cnblogs.com/genson/archive/2009/01/16/1306119.html
decimal是高精度 128bit,是不是浮点不是很清楚。
他们都有精度问题, 多数情况用decimal即可
float、float是primitive type
decimal不是 primitive type
注:
As Jeffrey Richter said, primitive types are any data type the compiler directly supports. In C#。
枚举只能用Primitive类型。
enum Flag : Int32 {},编译器就会报错,错误信息仅仅是“应输入类型 byte、sbyte、short、ushort、int、uint、long 或 ulong”
refence:
http://www.cnblogs.com/gf7788/archive/2009/07/24/1529848.html http://www.cnblogs.com/LeimOO/archive/2009/10/12/1581915.html http://msdn.microsoft.com/zh-cn/library/364x0z75%28VS.80%29.aspx http://www.cnblogs.com/genson/archive/2009/01/16/1306119.html
相关文章推荐
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- C#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- C#中对于float,double,decimal的误解
- c#中decimal ,double,float的区别
- C#的数据类型总结(2):decimal ,double,float的区别
- C#中decimal ,double,float的区别
- C#中decimal, double, float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- C#中对于float,double,decimal的误解收藏
- C# float double decimal 金额舍入 区别
- C#中对于float,double,decimal的误解
- MySQL类型float double decimal的区别
- 避免对C#中float,double,decimal的错误理解(转)
- MySQL中 DECIMAL FLOAT DOUBLE的区别