Kotlin 小數點四捨五入
fun Double.toFixed(s: Int): Double {
if (s == 0) return round(this)
val power = (10.0).pow(s)
return round(this * power) / power
}
fun Double.toFixed(s: Int): Double {
if (s == 0) return round(this)
val power = (10.0).pow(s)
return round(this * power) / power
}