c#中带2个小数点的舍入值
Rounding value with 2 decimal points in c#
double number1 = 4.1870418700000007d;
我试过以下方法:
输入: Math.Ceiling(number1)
输出: 5
输入: Math.Round(number1)
输出: 4
我想要输出:4.19
你很接近,是 Math.Round(number1, 2)
。它需要一个接受小数位数的重载。
double number1 = 4.1870418700000007d;
我试过以下方法:
输入: Math.Ceiling(number1)
输出: 5
输入: Math.Round(number1)
输出: 4
我想要输出:4.19
你很接近,是 Math.Round(number1, 2)
。它需要一个接受小数位数的重载。