PreciseRounding

Strategy to round a value precisely.

Properties

Link copied to clipboard
open override val mode: RoundingMode

The rounding mode used to round the decimal value.

Link copied to clipboard
open override val precision: Int

The precision to round the value (i.e., number of significant figures to use).

Functions

Link copied to clipboard
open operator override fun compareTo(other: Rounding): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun round(value: BigDecimal): BigDecimal
open override fun round(value: Double): Double
open override fun round(value: Float): Float

Rounds the given value.

fun round(block: () -> BigDecimal): BigDecimal
fun round(block: () -> Double): Double
fun round(block: () -> Float): Float

Rounds the value returned by the function block.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open infix fun with(precision: Int): Rounding

Returns a new Rounding with the given precision, keeping the current rounding mode.