roundTo

fun Float.roundTo(decimalPlaces: Int): Float

Rounds the Float to a specified number of decimal places. Uses RoundingMode.HALF_UP.

Return

The rounded Float.

Parameters

decimalPlaces

The number of decimal places to round to.