C#关于float类型的问题。
先声明:菜鸟,别砍我@-@floatj=1;F(i++,i++,++i);Console.WriteLine(1isint);Console.WriteLine(1isf...
先声明:菜鸟,别砍我@-@
float j = 1;
F(i++,i++,++i);
Console.WriteLine(1 is int);
Console.WriteLine(1 is float);
Console.WriteLine(1.0 is float);
Console.WriteLine(1.0 is double);
Console.WriteLine(j is float);
得到 TRUE
false
false
TRUE
TRUE
Console.WriteLine(1 is float)和Console.WriteLine(1.0 is float)为什么是False?! 是不是C#中未输入小数点的数字皆默认为int,带有小数点的默认为Double类型? 展开
float j = 1;
F(i++,i++,++i);
Console.WriteLine(1 is int);
Console.WriteLine(1 is float);
Console.WriteLine(1.0 is float);
Console.WriteLine(1.0 is double);
Console.WriteLine(j is float);
得到 TRUE
false
false
TRUE
TRUE
Console.WriteLine(1 is float)和Console.WriteLine(1.0 is float)为什么是False?! 是不是C#中未输入小数点的数字皆默认为int,带有小数点的默认为Double类型? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询