Skip to content

Instantly share code, notes, and snippets.

@bastman
Created February 17, 2020 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastman/bad0cb8546be913f9d62f246ef6c0514 to your computer and use it in GitHub Desktop.
Save bastman/bad0cb8546be913f9d62f246ef6c0514 to your computer and use it in GitHub Desktop.
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