https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

brabo-hi

09/20/2021, 9:13 PM
how should we handle BigDecimal and monetary values in KMM ?
until that is resolved, I'd do fixed-point manually for monetary units. Int + fixed offset of 2 should cover modern currencies and most reasonable values. Long + fixed offset of 8 will cover all Satoshis that can possibly exist. should be fine unless you're trying to express the world GDP in units of ZWL or something extreme like that
b

brabo-hi

09/21/2021, 12:43 AM
thanks @ephemient
m

Mike

09/21/2021, 2:48 AM
I use expect / actual to do this, for example on android I use actual implementation of BigDecimal
👍 1
e

ephemient

09/21/2021, 2:59 AM
you can do that, and there's polyfill support for the JS decimal proposal as well, but on native you'll have to pull in something like GMP or OpenSSL/bn
👍 1
8 Views