Created
February 17, 2020 15:25
-
-
Save bastman/bad0cb8546be913f9d62f246ef6c0514 to your computer and use it in GitHub Desktop.
round bigdecimal, double in kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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