formatCurrency

open override fun formatCurrency(value: Double, currency: String, decimals: Int?, grouping: Boolean): String

value in currency, with the locale's affixes around it.

The digits are formatted from the magnitude and the sign is carried by the affixes, because that is where a locale puts it: en-US writes -$1.00 but nl-NL writes € -1,00, and both come out of CurrencyAffixes rather than out of the number.

With no decimals the currency's own minor-unit count is used — 2 for USD, 0 for JPY — rather than formatNumber's shortest round-tripping form. An amount of money has a conventional precision where a bare number does not.