<https://github.com/eobermuhlner/kotlin-big-math#c...
# mathematics
i
👀
b
cc: @Eric Obermuhlner @voddan
u
Hey Brendan, could you give me a short overview on what's the discussion here?
u
If you have any suggestion on how to improve the BigDecimal, feel free share your thoughts, the API is still up for improvements, especially since I was mostly concentrating on BigInteger API.
a
We've recently added our own implementation of BigInteger based on Commons-math to Kmath: https://github.com/mipt-npm/kmath/blob/dev/kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/BigInt.kt. I personally do not use Big number much, so I do not know what are the requirements. And it is not the code I wrote myself, so the review and comments are welcome. Also I think it does not make a lot of sense to have separate implementations. If one of those is better than the others, I propose to join forces. Of course, for Kmath we are mostly interested in multiplatform implementations.
👍 2
b
Personally, I would prefer if
toString()
matched the behavior of Python, e.g.
valueOf(2.0) / valueOf(3.0) / valueOf(0.7)
should return
0.09523809523
instead of
1.0
(as it currently does in the stdlib)
To do it properly, I think you need some kind of symbolic representation like MST, but maybe there is a simpler solution IDK
Ideally, you would never loose precision as more operators are added to the expression
u
Ah, I see, well pull requests or an issue with a detailed description/plan is welcome! I don't have time to work on it at the moment but would love to see improvements on that side at some point. Thanks for bringing it up!
👍 1
Also I think it does not make a lot of sense to have separate implementations. If one of those is better than the others, I propose to join forces.
@altavir I agree, I'll look into possibilities of unifying efforts. Currently I'm a bit limited on time, and I have a hard requirement for native implementation (especially linux Arm64), so I'll keep slowly pushing on my implementation, but keep unifying the code in mind.
a
@Ugi We sadly do not currently support native, because it requires a lot of work. But I expect to support native since Kotlin 1.4 And multiplatform algoritms should work there.
👍 1