BigDecimal

fun BigDecimal(val: Double, mc: MathContext = MathContext.UNLIMITED)

Translates a double into a BigDecimal, with rounding according to the context settings. The _scale of the BigDecimal is the smallest value such that (10<sup>_scale</sup> val) is an integer.

The results of this constructor can be somewhat unpredictable and its use is generally not recommended; see the notes under the aforementioned constructor.

Since

1.5

Parameters

val

double value to be converted to BigDecimal.

mc

the context to use.

Throws

if the result is inexact but the RoundingMode is UNNECESSARY.

if val is infinite or NaN.