float a = 0.6f;
float b = 6/10f;
double c = (double)a;
double d = (double)b;
double e = Convert.ToDouble(6/10f);
double f = (double)(6/10f);
这种精度丢失问题,我搞不清楚,下面链接你参考下:
http://www.cnblogs.com/wodehuajianrui/archive/2009/03/18/1415173.html
http://www.cnblogs.com/HarryHuang/archive/2010/03/21/1690910.html
楼主是否可以把源码帖出,我测试了一下:
class Program
{
static void Main(string[] args)
{
Console.WriteLine((double)(float)(6/10f));
}
}
运行结果为:0.600000023841858。你需要查一下double精度的有效位。