Is there an official or widely used BigDecimal KMM...
# mathematics
s
Is there an official or widely used BigDecimal KMM equivalent, or do I need to
expect
these various implementations? https://discuss.kotlinlang.org/t/multiplatform-bigdecimal-implementation/5631/10
a
There are several implementations of BigInt that could be used in KMM (including the one from KMath (https://github.com/SciProgCentre/kmath/blob/master/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt). But in many cases it does not have BigDecimals. Adding BigDecimal on top of BigInt is an easy step, but somebody have to do it. So contributions are welcome.
a
there’s nothing official - add your 👍 to https://youtrack.jetbrains.com/issue/KT-20912
a
I do not think that bigint in stdlib is a good solution. It is not easy to make it really good. I think it is much better to solve the problem on library level.
One size does not fit all in mathematics.
s
@altavir so how do you explain the success of BigDecimal (in terms of adoption)?
a
You mean Java? It took tremendous amounts of work to make it be like it is right now. And still there are some deficiencies. For example, Java BigDecimal API is quite limited. It does not override operations. We can override operations in Kotlin, but it still is not easy to do in a universal way for BD, because you need MathContext in mind.
s
True
a
Since Kotlin has a robust library system, I prefer to have things that could be opinionated in libraries rather than in stdlib.
👍 1