Package-level declarations

Core functions and types.

Types

Link copied to clipboard

Strategy that does not round a value.

Link copied to clipboard

Strategy to round a value precisely.

Link copied to clipboard
sealed class Rounding : Comparable<Rounding>

Strategy to round a Double or Float value to a given precision scale using a specified java.math.RoundingMode policy. The companion object exposes two factory methods to create the appropriate strategy:

Functions

Link copied to clipboard
fun Int.cubed(): Int
fun Long.cubed(): Long

Returns the cube of the number.

Link copied to clipboard
infix fun BigDecimal.round(rounding: Rounding): BigDecimal
fun () -> BigDecimal.round(rounding: Rounding): BigDecimal

Rounds the BigDecimal using the given Rounding.

infix fun BigDecimal.round(scale: Int): BigDecimal
fun () -> BigDecimal.round(scale: Int): BigDecimal

Rounds the BigDecimal to a given precision scale using java.math.RoundingMode.HALF_EVEN rounding mode.

infix fun Double.round(rounding: Rounding): Double
fun () -> Double.round(rounding: Rounding): Double
fun () -> Float.round(rounding: Rounding): Float

Rounds the double value using the given Rounding.

infix fun Double.round(scale: Int): Double
fun () -> Double.round(scale: Int): Double
fun () -> Float.round(scale: Int): Float

Rounds the double value to a given precision scale using java.math.RoundingMode.HALF_EVEN rounding mode.

infix fun Float.round(rounding: Rounding): Float

Rounds the float value using the given Rounding.

infix fun Float.round(scale: Int): Float

Rounds the float value to a given precision scale using java.math.RoundingMode.HALF_EVEN rounding mode.

Link copied to clipboard
fun Int.squared(): Int

Returns the square of the number.