Functional Weave
Code in Python

money.currency-digits@1.0.0

README.md

1,284 bytes · view raw

# money.currency-digits

The number of decimal places in a currency's minor unit: 2 for pounds and
euros, 0 for yen and won, 3 for Kuwaiti and Bahraini dinar, 4 for the Chilean
Unidad de Fomento. Anything that turns minor units into major units - parsing,
converting, displaying - needs this, and dividing by 100 is wrong for about a
sixth of the world's currencies.

The table in `data/currency-digits.json` is ISO 4217 List One as published by
SIX Financial Information, the ISO 4217 maintenance agency, on 2026-09-17:
every active currency code with a numeric minor unit (165 codes). Precious
metals, fund codes and testing codes whose minor unit is "N.A." (XAU, XAG,
XDR, XTS, XXX and the like) are left out, and asking for one is an error, as
is any code not on the list. Codes are matched exactly, so `"gbp"` is an
error rather than a guess.

Source: ISO 4217 Currency Code Maintenance, List One: Currency, fund and
precious metal codes -
https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
(published 2026-09-17).

When ISO amends the list, publish a new version with the new table. The
digits are what ISO says, not what a country's cash uses day to day: ISK and
UGX are 0, HUF is 2 even though forint coins stopped at 1.