BigInt

Represents an arbitrary-sized Big Integer.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

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

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
open val isZero: Boolean

Determines if this BigInt is 0

Link copied to clipboard
abstract val signum: Int

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

Functions

Link copied to clipboard
open fun abs(): BigInt

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

Link copied to clipboard
abstract infix fun and(other: BigInt): BigInt

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

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

Returns a new BigInt this this / other

open operator fun div(other: Int): BigInt

Returns this / other

Link copied to clipboard
abstract fun inv(): BigInt

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

Link copied to clipboard
abstract operator fun minus(other: BigInt): BigInt

Returns a new BigInt this this - other

open operator fun minus(other: Int): BigInt

Returns this - other

Link copied to clipboard
abstract infix fun or(other: BigInt): BigInt

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

Link copied to clipboard
abstract operator fun plus(other: BigInt): BigInt

Returns a new BigInt this this + other

open operator fun plus(other: Int): BigInt

Returns this + other

Link copied to clipboard
abstract infix fun pow(exponent: BigInt): BigInt
abstract infix fun pow(exponent: Int): BigInt

Returns this BigInt raised to exponent : this ** exponent

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
abstract operator fun rem(other: BigInt): BigInt

Returns a new BigInt this this % other

open operator fun rem(other: Int): BigInt

Returns this % other

Link copied to clipboard
abstract infix fun shl(count: Int): BigInt

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
abstract infix fun shr(count: Int): BigInt

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 fun square(): BigInt

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

Link copied to clipboard
abstract operator fun times(other: BigInt): BigInt

Returns a new BigInt this this * other

open operator fun times(other: Int): BigInt
open operator fun times(other: Long): BigInt

Returns this * other

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

Converts a BigInt into a BigInteger

Link copied to clipboard
abstract 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
abstract 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
abstract operator fun unaryMinus(): BigInt

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

Link copied to clipboard
open operator fun unaryPlus(): BigInt

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

Link copied to clipboard
abstract infix fun xor(other: BigInt): BigInt

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