CommonBigInt

Types

Link copied to clipboard
Link copied to clipboard
data class DivRem(val div: CommonBigInt, val rem: CommonBigInt)
Link copied to clipboard
data class OpStats(var iterations: Int = 0, var bigMultiplications: Int = 0, var square: Int = 0)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determines if this BigInt is negative

Link copied to clipboard

Determines if this BigInt is either negative or zero (non-positive)

Link copied to clipboard
open val isNotZero: Boolean

Determines if this BigInt is not 0

Link copied to clipboard
Link copied to clipboard

Determines if this BigInt is positive

Link copied to clipboard

Determines if this BigInt is either positive or zero (non-negative)

Link copied to clipboard
Link copied to clipboard
open val isZero: Boolean

Determines if this BigInt is 0

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val signum: Int

Returns -1, 0 or +1 depending on the sign of this BigInt

Functions

Link copied to clipboard
open override fun abs(): CommonBigInt

Returns this BigInt as positive or zero. Equivalent to if (isNegative) -this else this

Link copied to clipboard
open infix override fun and(other: BigInt): CommonBigInt

Returns a new BigInt with bits combining this, other doing a bitwise &/and operation. Forces sign to positive.

Link copied to clipboard
open operator override fun compareTo(that: BigInt): Int
Link copied to clipboard
fun countBits(): Int
Link copied to clipboard
open override fun create(value: Int): BigInt
open override fun create(value: Long): BigInt
open override fun create(value: String): BigInt
open override fun create(value: String, radix: Int): BigInt
Link copied to clipboard
open operator override fun div(other: BigInt): CommonBigInt

Returns a new BigInt this this / other

open operator override fun div(other: Int): CommonBigInt

Returns this / other

Link copied to clipboard
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getBit(n: Int): Boolean
Link copied to clipboard
fun getBitInt(n: Int): Int
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun inv(): CommonBigInt

Returns a new BigInt with its bits flipped. 0 converts into 1, and 1 into 0. Equivalent to -(this + 1)

Link copied to clipboard

Number of leadingZeros with the size of maxBits

Link copied to clipboard
open operator override fun minus(other: BigInt): CommonBigInt

Returns a new BigInt this this - other

open operator override fun minus(other: Int): CommonBigInt

Returns this - other

Link copied to clipboard
fun mulAddSmall(mul: Int, add: Int): CommonBigInt
Link copied to clipboard
Link copied to clipboard
open infix override fun or(other: BigInt): CommonBigInt

Returns a new BigInt with bits combining this, other doing a bitwise |/or operation. Forces sign to positive.

Link copied to clipboard
open operator override fun plus(other: BigInt): CommonBigInt

Returns a new BigInt this this + other

open operator override fun plus(other: Int): CommonBigInt

Returns this + other

Link copied to clipboard
open infix override fun pow(exponent: BigInt): CommonBigInt
open infix override fun pow(exponent: Int): CommonBigInt

Returns this BigInt raised to exponent : this ** exponent

Link copied to clipboard
Link copied to clipboard
open operator fun rangeTo(that: BigInt): BigIntRange

Creates a new inclusive BigIntRange ranging from this to that

Link copied to clipboard
open operator override fun rem(other: BigInt): CommonBigInt

Returns a new BigInt this this % other

open operator override fun rem(other: Int): CommonBigInt

Returns this % other

Link copied to clipboard
open infix override fun shl(count: Int): CommonBigInt

Returns a new BigInt with bits from this shifted to the left count. Equivalent to multiply by 2**count. Keeps the sign of this

Link copied to clipboard
open infix override fun shr(count: Int): CommonBigInt

Returns a new BigInt with bits from this shifted to the left count. Equivalent to divide by 2**count. Keeps the sign of this

Link copied to clipboard
open override fun square(): CommonBigInt

Square of this number. Equivalent this * this, but might be faster in some implementations.

Link copied to clipboard
open operator override fun times(other: BigInt): CommonBigInt

Returns a new BigInt this this * other

open operator override fun times(other: Int): CommonBigInt
open operator override fun times(other: Long): CommonBigInt

Returns this * other

Link copied to clipboard
fun BigInt.toBigInteger(): <Error class: unknown class>

Converts a BigInt into a BigInteger

Link copied to clipboard
Link copied to clipboard
open override fun toInt(): Int

Converts this number to a Int. Throws a BigIntOverflowException in the case the number is too big to be stored in an Int

Link copied to clipboard
open override fun toString(): String
fun toString(sb: StringBuilder, radix: Int)

open override fun toString(radix: Int): String

Converts this number to a String using the specified radix. The radix is the base to use. 10 for decimal. 16 for hexadecimal.

Link copied to clipboard

Number of trailingZeros with the size of maxBits

Link copied to clipboard
open operator override fun unaryMinus(): CommonBigInt

Returns a new BigInt with its sign changed. In the case of 0, it returns itself.

Link copied to clipboard
open operator override fun unaryPlus(): CommonBigInt

Returns this BigInt. A convenience method to make explicit the sign and to have symmetry with unaryMinus.

Link copied to clipboard
fun withBit(bit: Int, set: Boolean = true): CommonBigInt
Link copied to clipboard
open infix override fun xor(other: BigInt): CommonBigInt

Returns a new BigInt with bits combining this, other doing a bitwise ^/xor operation. Forces sign to positive.