Scoop API

scoop:scoop.math:0.1.0

src/big_integer/conversions.scoop

Selected production source · src/big_integer/conversions.scoop

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