zcash-android-wallet-sdk / cash.z.wallet.sdk.ext / kotlin.Long / convertZatoshiToZec

convertZatoshiToZec

fun Long?.convertZatoshiToZec(scale: Int = ZEC_FORMATTER.maximumFractionDigits): BigDecimal

Convert a Zatoshi value into ZEC, right-padded to the given number of fraction digits, represented as a BigDecimal in order to preserve rounding that minimizes cumulative error when applied repeatedly over a sequence of calculations. Start with Zatoshi -> End with ZEC.

Parameters

scale - the number of digits to the right of the decimal place. Right-padding will be added, if necessary.

Return
this Long Zatoshi value represented as ZEC using a BigDecimal with the given scale, rounded accurately out to 128 digits.