round

fun FloatArray.round(): FloatArray

Rounds the given value Array towards the closest integer with ties rounded towards even integer.

Example:

arrayOf(31.62F, 10F, 3.16F).round() // [32F, 10F, 3F]

Since

1.1.0

See also

round

fun DoubleArray.round(): DoubleArray

Rounds the given value Array towards the closest integer with ties rounded towards even integer.

Example:

arrayOf(31.622776601683793, 10.0, 3.1622776601683795).round() // [32.0, 10.0, 3.0]

Since

1.1.0

See also

round

@JvmName(name = "roundFloat")
fun Iterable<Float>.round(): Iterable<Float>

Rounds the given value Iterable towards the closest integer with ties rounded towards even integer.

Example:

listOf(31.62F, 10F, 3.16F).round() // [32F, 10F, 3F]

Since

1.1.0

See also

round

@JvmName(name = "roundDouble")
fun Iterable<Double>.round(): Iterable<Double>

Rounds the given value Iterable towards the closest integer with ties rounded towards even integer.

Example:

listOf(31.622776601683793, 10.0, 3.1622776601683795).round() // [32.0, 10.0, 3.0]

Since

1.1.0

See also

round

@JvmOverloads
fun round(number: Float, digits: Int = 0): Float

Rounds the given value number towards the closest integer with digits of rounding.

Example:

round(1.999F) // 2.0F
round(1.856F, 1) // 1.9F
round(1.856F, 2) // 1.86FF

Since

1.1.0

See also

round

@JvmOverloads
fun round(number: Double, digits: Int = 0): Double

Rounds the given value number towards the closest integer with digits of rounding.

Example:

round(1.999) // 2.0
round(1.856, 1) // 1.9
round(1.856, 2) // 1.86F

Since

1.1.0

See also

round

@JvmName(name = "roundExtension")
fun Float.round(digits: Int = 0): Float

Rounds the given value this towards the closest integer with digits of rounding.

Example:

1.999F.round() // 2.0F
1.856F.round(1) // 1.9F
1.856F.round(2) // 1.86F

Since

1.1.0

See also

round

@JvmName(name = "roundExtension")
fun Double.round(digits: Int = 0): Double

Rounds the given value this towards the closest integer with digits of rounding.

Example:

1.999.round() // 2.0
1.856.round(1) // 1.9
1.856.round(2) // 1.86

Since

1.1.0

See also

round