Skip to content

Instantly share code, notes, and snippets.

@bastman

bastman/RoundKt.kt

Created Feb 17, 2020
Embed
What would you like to do?
round bigdecimal, double in kotlin
import java.math.*
fun main() {
println("Hello, world!!!")
val myValue=-1.25
val out = BigDecimal(myValue).setScale(1, RoundingMode.HALF_UP).toDouble();
println("$out")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment