I’m sorry, but you seem to be reading between my lines. I never said the round2 somehow solves the needs of financial software. The point of my post was that some problems with decimal arithmetics can be solved with binary floating point and showed one such problem with the corresponding solution. Can all the problems be solved in such a way? Definitely not. Does it mean if should use floating point in your financial code? Absolutely not, because it depends on what problems you are solving in your code and what tradeoffs you are making. Moreover, I did show how easy it is to get it wrong. Hopefully, this discourages masses from “trying it at home”.

As for performance side, I do promise to write a story on the perils of microbenchmarking one day. Stay tuned.

Written by

Project Lead for the Kotlin Programming Language @JetBrains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store