toBigDecimal

Returns the value of this Int number as a BigDecimal.

Since Kotlin

1.2

inline fun Int.toBigDecimal(mathContext: MathContext): BigDecimal(source)

Returns the value of this Int number as a BigDecimal.

Since Kotlin

1.2

Parameters

mathContext

specifies the precision and the rounding mode.


Returns the value of this Long number as a BigDecimal.

Since Kotlin

1.2

inline fun Long.toBigDecimal(mathContext: MathContext): BigDecimal(source)

Returns the value of this Long number as a BigDecimal.

Since Kotlin

1.2

Parameters

mathContext

specifies the precision and the rounding mode.


Returns the value of this Float number as a BigDecimal.

The number is converted to a string and then the string is converted to a BigDecimal.

Since Kotlin

1.2

inline fun Float.toBigDecimal(mathContext: MathContext): BigDecimal(source)

Returns the value of this Float number as a BigDecimal.

The number is converted to a string and then the string is converted to a BigDecimal.

Since Kotlin

1.2

Parameters

mathContext

specifies the precision and the rounding mode.


Returns the value of this Double number as a BigDecimal.

The number is converted to a string and then the string is converted to a BigDecimal.

Since Kotlin

1.2

inline fun Double.toBigDecimal(mathContext: MathContext): BigDecimal(source)

Returns the value of this Double number as a BigDecimal.

The number is converted to a string and then the string is converted to a BigDecimal.

Since Kotlin

1.2

Parameters

mathContext

specifies the precision and the rounding mode.


Returns the value of this BigInteger number as a BigDecimal.

Since Kotlin

1.2

inline fun BigInteger.toBigDecimal(scale: Int = 0, mathContext: MathContext = MathContext.UNLIMITED): BigDecimal(source)

Returns the value of this BigInteger number as a BigDecimal scaled according to the specified scale and rounded according to the settings specified with mathContext.

Since Kotlin

1.2

Parameters

scale

the scale of the resulting BigDecimal, i.e. number of decimal places of the fractional part. By default 0.