文章日志
日志类别:DOTNET
2018-07-21 10:52

Math.Ceiling()向上取整,Math.Floor()向下取整 


示例: 

d = 4.56789 


string res = Math.Ceiling(Convert.ToDecimal(d)).ToString() 

string res = Math.Ceiling(Convert.ToDouble(d)).ToString(); 

res为5 


string res = Math.Floor(Convert.ToDecimal(d)).ToString() 

string res = Math.Floor(Convert.ToDouble(d)).ToString(); 
res为4


0    0
昵称: