任何人都可以解释为什么下面的第三个输出打印出一个从预期值128的值?
我使用Target framework = .NET Framework 4运行以下代码
码:
static void Main(string[] args)
{
float f = 3510000000f;
double d = 3510000000d;
Console.WriteLine("f = {0:f1}", f);
Console.WriteLine("d = {0:f1}", d);
Console.WriteLine("f converted to a double = {0:f1}",
Convert.ToDouble(f));
Console.WriteLine("f converted to a double using strings = {0:f1}",
Convert.ToDouble(f.ToString()));
}
Run Code Online (Sandbox Code Playgroud) .net ×1