If you want to round a double value to specific decimal places and print it, you can use java.math.BigDecimal.
import java.math.BigDecimal
import java.math.RoundingMode
val decimal = BigDecimal(3.14159265359).setScale(2, RoundingMode.HALF_EVEN)
println(decimal) // 3.14
Or if you just want to compare it with the rounded value, you can use round method.
import kotlin.math.round
println(round(3.14159265359 * 100) / 100 == 3.14) // true
You can do same thing with @fvasco’s extension method.
3.14159265359.round(2) // 3.14