Math.Round(11.4)=11
Math.Round(11.5)=12
Math.Round(-11.5)=-12
Math.Round(-11.4)=-11
结果如下截图:
static void Main(string[] args)
{
Console.WriteLine("Math.Round(11.4)=" + Math.Round(11.4));
Console.WriteLine("Math.Round(11.5)=" + Math.Round(11.5));
Console.WriteLine("Math.Round(-11.5)=" + Math.Round(-11.5));
Console.WriteLine("Math.Round(-11.4)=" + Math.Round(-11.4));
}

本文详细介绍了Math.Round函数在浮点数四舍五入过程中的行为,通过四个示例展示了正负数结果的不同,并提供了C#代码演示。重点在于理解Math.Round的规则在实际应用中的表现。
2223

被折叠的 条评论
为什么被折叠?



