Yes. It will be possible with inline classes. Actually, to implement a decimal arithmetics with fixed number of digits after the decimal point there is an even faster and easier implementation using long as a base type. It would give you even more precisions — full 18 decimal digits. I might write a separate story about that one day. Maybe when inline classes are added to Kotlin :)

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