kotlin中将数字舍入到小数点后n位
Round number to n decimal places in kotlin
如何在 kotlin 中将 47.3476 舍入为 47.35
val num = 47.3476
val df = DecimalFormat("#.##")//set decimal format here
df.roundingMode = RoundingMode.CEILING
println(df.format(num)) //47.35
如何在 kotlin 中将 47.3476 舍入为 47.35
val num = 47.3476
val df = DecimalFormat("#.##")//set decimal format here
df.roundingMode = RoundingMode.CEILING
println(df.format(num)) //47.35