
Implements arbitrary-precision arithmetic with a BigInt type, mirroring Java's BigInteger. Supports construction from various types and includes operations like addition, subtraction, bitwise manipulation, and more.
= Big Numbers :source-highlighter: highlightjs :gh-group: k-libs :gh-name: k-big-numbers :lib-package: io.klibs.math.big :lib-group: io.k-libs :lib-name: big-numbers :lib-version: 0.1.1 :lib-feature: 0.1.0
image:https://img.shields.io/github/license/{gh-group}/{gh-name}[title="License"] image:https://img.shields.io/badge/docs-dokka-ff69b4[link="https://{gh-group}.github.io/{gh-name}/dokka/{lib-feature}/{lib-name}/{lib-package}/index.html"] image:https://img.shields.io/maven-central/v/{lib-group}/{lib-name}[link="https://search.maven.org/artifact/{lib-group}/{lib-name}"]
BigInt implementation.
Heavily based on Java's BigInteger type.
== Import
== Usage
=== Construction
// From String to BigInt "0".toBigInt() bigIntOf("0")
// From Byte to BigInt 0.toByte().toBigInt() bigIntOf(0.toByte())
// From Short to BigInt 0.toShort().toBigInt() bigIntOf(0.toShort())
// From Int to BigInt 0.toBigInt() bigIntOf(0)
// From Long to BigInt 0L.toBigInt() bigIntOf(0L)
// From UByte to BigInt 0.toUByte().toBigInt() bigIntOf(0.toUByte())
// From UShort to BigInt 0.toUShort().toBigInt() bigIntOf(0.toUShort())
// From UInt to BigInt 0u.toBigInt() bigIntOf(0u)
=== Operations
val b1: BigInt val b2: BigInt var b3: BigInt
// Addition b3 = b1 + b2 b3 = b1 + 2
// Subtraction b3 = b1 - b2 b3 = b1 - 2
// Multiplication b3 = b1 * b2 b3 = b1 * 2
// Division b3 = b1 / b2 b3 = b1 / 2
// Modulus b3 = b1 % b2 b3 = b1 % 2
// Exponent b3 = b1 pow 2
// Negate b3 = -b1
// Bit Shift b3 = b1 shl 2 b3 = b2 shr 3
// Bitwise AND b3 = b1 and b2 b3 = b1 and 2
// Bitwise OR b3 = b1 or b2 b3 = b1 or 2
// Bitwise XOR b3 = b1 xor b2 b3 = b1 xor 2
// Bitwise AND NOT b3 = b1 andNot b2 b3 = b1 andNot 2
// Bitwise NOT b3 = b1.inv()
// Absolute Value b3 = b1.abs()
== Version History
[%headers, cols="1m,1,8"] |=== | Version | Docs | Description
| v0.1.0 | https://{gh-group}.github.io/{gh-name}/dokka/0.1.0/{lib-name}/{lib-package}/index.html[Dokka] | Initial Release |===
= Big Numbers :source-highlighter: highlightjs :gh-group: k-libs :gh-name: k-big-numbers :lib-package: io.klibs.math.big :lib-group: io.k-libs :lib-name: big-numbers :lib-version: 0.1.1 :lib-feature: 0.1.0
image:https://img.shields.io/github/license/{gh-group}/{gh-name}[title="License"] image:https://img.shields.io/badge/docs-dokka-ff69b4[link="https://{gh-group}.github.io/{gh-name}/dokka/{lib-feature}/{lib-name}/{lib-package}/index.html"] image:https://img.shields.io/maven-central/v/{lib-group}/{lib-name}[link="https://search.maven.org/artifact/{lib-group}/{lib-name}"]
BigInt implementation.
Heavily based on Java's BigInteger type.
== Import
== Usage
=== Construction
// From String to BigInt "0".toBigInt() bigIntOf("0")
// From Byte to BigInt 0.toByte().toBigInt() bigIntOf(0.toByte())
// From Short to BigInt 0.toShort().toBigInt() bigIntOf(0.toShort())
// From Int to BigInt 0.toBigInt() bigIntOf(0)
// From Long to BigInt 0L.toBigInt() bigIntOf(0L)
// From UByte to BigInt 0.toUByte().toBigInt() bigIntOf(0.toUByte())
// From UShort to BigInt 0.toUShort().toBigInt() bigIntOf(0.toUShort())
// From UInt to BigInt 0u.toBigInt() bigIntOf(0u)
=== Operations
val b1: BigInt val b2: BigInt var b3: BigInt
// Addition b3 = b1 + b2 b3 = b1 + 2
// Subtraction b3 = b1 - b2 b3 = b1 - 2
// Multiplication b3 = b1 * b2 b3 = b1 * 2
// Division b3 = b1 / b2 b3 = b1 / 2
// Modulus b3 = b1 % b2 b3 = b1 % 2
// Exponent b3 = b1 pow 2
// Negate b3 = -b1
// Bit Shift b3 = b1 shl 2 b3 = b2 shr 3
// Bitwise AND b3 = b1 and b2 b3 = b1 and 2
// Bitwise OR b3 = b1 or b2 b3 = b1 or 2
// Bitwise XOR b3 = b1 xor b2 b3 = b1 xor 2
// Bitwise AND NOT b3 = b1 andNot b2 b3 = b1 andNot 2
// Bitwise NOT b3 = b1.inv()
// Absolute Value b3 = b1.abs()
== Version History
[%headers, cols="1m,1,8"] |=== | Version | Docs | Description
| v0.1.0 | https://{gh-group}.github.io/{gh-name}/dokka/0.1.0/{lib-name}/{lib-package}/index.html[Dokka] | Initial Release |===