Scoop API

scoop:scoop.math:0.1.0

BigInteger

class BigInteger

source · line 9
public
public class BigInteger internal constructor(private val storage: IntegerStorage) : Equals<BigInteger>, Compare<BigInteger>, Hash, ToString, Add<BigInteger, BigInteger>, Sub<BigInteger, BigInteger>, Mul<BigInteger, BigInteger>, Div<BigInteger, BigInteger>, Rem<BigInteger, BigInteger>, UnaryPlus<BigInteger>, UnaryMinus<BigInteger>, Increment<BigInteger>, Decrement<BigInteger>

An immutable arbitrary-precision signed integer with infinite two's-complement bit semantics.

Extensions

function toUIntExact

source · line 163
public
public fun toUIntExact(): UInt

Converts exactly; an out-of-range value throws ArithmeticException.

function toShort

source · line 126
public
public fun toShort(): Short

Takes the low 16 bits and interprets them as Short.

function toLong

source · line 140
public
public fun toLong(): Long

Takes the low 64 bits and interprets them as Long.

function toUByte

source · line 147
public
public fun toUByte(): UByte

Takes the low 8 bits and interprets them as UByte.

function toDouble

source · line 117
public
public fun toDouble(): Double

Rounds directly to binary64 with nearest-even rounding, allowing infinity.

function toShortExact

source · line 128
public
public fun toShortExact(): Short

Converts exactly; an out-of-range value throws ArithmeticException.

function toFloat

source · line 115
public
public fun toFloat(): Float

Rounds directly to binary32 with nearest-even rounding, allowing infinity.

function toLongExact

source · line 142
public
public fun toLongExact(): Long

Converts exactly; an out-of-range value throws ArithmeticException.

function toUShort

source · line 154
public
public fun toUShort(): UShort

Takes the low 16 bits and interprets them as UShort.

function toULong

source · line 168
public
public fun toULong(): ULong

Takes the low 64 bits and interprets them as ULong.

function bitCount

source · line 84
public
public fun bitCount(): Long

Counts bits differing from the infinitely extended sign bit.

function toUShortExact

source · line 156
public
public fun toUShortExact(): UShort

Converts exactly; an out-of-range value throws ArithmeticException.

function toUByteExact

source · line 149
public
public fun toUByteExact(): UByte

Converts exactly; an out-of-range value throws ArithmeticException.

function bitLength

source · line 82
public
public fun bitLength(): Long

Counts bits after removing redundant sign extension; zero and -1 have length zero.

function toInt

source · line 133
public
public fun toInt(): Int

Takes the low 32 bits and interprets them as Int.

function toIntExact

source · line 135
public
public fun toIntExact(): Int

Converts exactly; an out-of-range value throws ArithmeticException.

function toByte

source · line 119
public
public fun toByte(): Byte

Takes the low 8 bits and interprets them as Byte.

function sqrt

source · line 66
public
public fun sqrt(): BigInteger

Returns floor(sqrt(this)); negative values throw ArithmeticException.

function toUInt

source · line 161
public
public fun toUInt(): UInt

Takes the low 32 bits and interprets them as UInt.

function lowestSetBit

source · line 86
public
public fun lowestSetBit(): Long

Returns the lowest set bit, or -1 for zero.

function toByteExact

source · line 121
public
public fun toByteExact(): Byte

Converts exactly; an out-of-range value throws ArithmeticException.

function toULongExact

source · line 170
public
public fun toULongExact(): ULong

Converts exactly; an out-of-range value throws ArithmeticException.