scoop:scoop.math:0.1.0
src/big_decimal/conversions.scoop
Selected production source · src/big_decimal/conversions.scoop
1
package scoop.math3
/** Parses ASCII decimal text with optional e/E exponent, preserving trailing zeros. */4
public fun String.toBigDecimal(): BigDecimal = BigDecimal.parse(this)5
/** Returns None for malformed decimal text or an unrepresentable scale. */6
public fun String.toBigDecimalOrNone(): BigDecimal? = BigDecimal.parseOrNone(this)7
/** Shares this immutable integer as a decimal coefficient at scale zero. */8
public fun BigInteger.toBigDecimal(): BigDecimal = BigDecimal(this)9
/** Converts the mathematical integer exactly at scale zero. */10
public fun Byte.toBigDecimal(): BigDecimal = BigDecimal(toLong())11
/** Converts the mathematical integer exactly at scale zero. */12
public fun Short.toBigDecimal(): BigDecimal = BigDecimal(toLong())13
/** Converts the mathematical integer exactly at scale zero. */14
public fun Int.toBigDecimal(): BigDecimal = BigDecimal(toLong())15
/** Converts the mathematical integer exactly at scale zero. */16
public fun Long.toBigDecimal(): BigDecimal = BigDecimal(toLong())17
/** Converts the mathematical integer exactly at scale zero. */18
public fun UByte.toBigDecimal(): BigDecimal = BigDecimal(toULong())19
/** Converts the mathematical integer exactly at scale zero. */20
public fun UShort.toBigDecimal(): BigDecimal = BigDecimal(toULong())21
/** Converts the mathematical integer exactly at scale zero. */22
public fun UInt.toBigDecimal(): BigDecimal = BigDecimal(toULong())23
/** Converts the mathematical integer exactly at scale zero. */24
public fun ULong.toBigDecimal(): BigDecimal = BigDecimal(toULong())