scoop:scoop.math:0.1.0
src/big_integer/conversions.scoop
Selected production source · src/big_integer/conversions.scoop
1
package scoop.math3
/** Parses signed ASCII digits in radix 2..36; malformed text throws NumberFormatException. */4
public fun String.toBigInteger(radix: Int = 10): BigInteger = BigInteger.parse(this, radix)5
/** Returns None for malformed digits; an invalid radix still throws IllegalArgumentException. */6
public fun String.toBigIntegerOrNone(radix: Int = 10): BigInteger? = BigInteger.parseOrNone(this, radix)7
/** Converts the mathematical integer exactly. */8
public fun Byte.toBigInteger(): BigInteger = BigInteger(toLong())9
/** Converts the mathematical integer exactly. */10
public fun Short.toBigInteger(): BigInteger = BigInteger(toLong())11
/** Converts the mathematical integer exactly. */12
public fun Int.toBigInteger(): BigInteger = BigInteger(toLong())13
/** Converts the mathematical integer exactly. */14
public fun Long.toBigInteger(): BigInteger = BigInteger(toLong())15
/** Converts the mathematical integer exactly. */16
public fun UByte.toBigInteger(): BigInteger = BigInteger(toULong())17
/** Converts the mathematical integer exactly. */18
public fun UShort.toBigInteger(): BigInteger = BigInteger(toULong())19
/** Converts the mathematical integer exactly. */20
public fun UInt.toBigInteger(): BigInteger = BigInteger(toULong())21
/** Converts the mathematical integer exactly. */22
public fun ULong.toBigInteger(): BigInteger = BigInteger(toULong())