ribesg
03/29/2024, 3:46 PMSam
03/29/2024, 4:01 PMribesg
03/29/2024, 4:03 PMexpect
/ actual
.
In my case I'm in common Compose code and I just wanted to make a quick function to round numbers for display. It can't be that hard, right? 🤡Sam
03/29/2024, 4:07 PMSam
03/29/2024, 4:08 PMPablichjenkov
03/29/2024, 7:10 PMedrd
03/29/2024, 11:08 PMNot sure about your specific concern but usually in finance you either work with Big decimal which I think has a KMP lib somewhere or you just don’t use decimal points.+1. Worked on a big finance project and we used BigDecimal wrapped inside a value class for some added niceties and had zero issues with rounding/precision.
darkmoon_uk
03/30/2024, 2:27 PMBigDecimal
and NSDecimalNumber
for a financial product. Unfortunately I can't make the code available, but it was successful despite not being as trivial as you might hope! Nice thing was I ended up with a battery of many Unit Tests in common code that asserted the same results from both platforms across many types of rounding and arithmetic operations to prove it. I also used value class as @edrd did.