KBigInt
Kotlin Multiplatform BigInteger library.
Platforms
Platform | Implementation |
---|---|
JVM | BigInteger |
Android | BigInteger |
JS | BigInt* |
Native | LibTomMath |
WASM | Not implemented |
* Kotlin/JS does not fully support BigInt
(KT-48980).
Motivation
Kotlin does not support BigInteger
and BigDecimal
types in multiplatform projects (KT-20912).
However, I was not interested in BigDecimal
so this library only implements BigInteger
.
Serialization is implemented in a separate module so the main library can be used on its own.
Alternatives
kotlin-multiplatform-bignum
-
Fully custom implementation.
korlibs-bignumber
-
Internal library.
-
No serialization.
-
Custom Native implementation.
mpbignum
-
Internal library.
-
No serialization.
-
Depends on
Apache Commons Math
in JVM. -
Only Linux is supported in Native (using
gmp
).
kmulti-bignumber
-
No longer updated.
-
No serialization.
-
Stub JS implementation.
-
No Native implementation.