C#中Math的使用总结

1、向上进位取整。Math.Ceiling

    例如: Math.Ceiling(32.6)=33; Math.Ceiling(32.0)=32;

2、向下舍位取整。Math.Floor

    例如: Math.Floor(32.6)=32;

3、取指定位数的小数。Math.Round

    例如:Math.Round(36.236,2)=36.24; Math.Round(36.232,2)=36.23;
4、取指定数字在使用指定底时的对数。Math.Log

    例如:一本16开的书,计算对开了几次。Math.Log(16,2)=4;

原文地址:https://www.cnblogs.com/soundcode/p/3296071.html