False Assumptions
A strange Poker Copilot bug report arrived yesterday: for one user the cents part of bets, table stakes, and statistics were not being shown. A $0.05/$0.10 table was shown as $0/$0.
Fortunately the person who reported the bug discovered the source: if your Mac was set to run in Japanese, then this happened. The reason is that the Japanese Yen doesn’t get divided into hundredths, cents, centavos, kopecks, pennies, or fens. Therefore when you get the system currency formatter it doesn’t want to show that part of the currency.
I had mistakenly assumed that all currencies are split into hundredths. This may seem an obscure localisation problem to some, but must be faced by many companies large and small.
The next update will “fix” this: I’m now forcing the currency formatter to use two decimal places. Ideally though, I need a library that will allow me to format currency X as per the custom in locale Y.
UPDATE:
Wikipedia has a comprehensive list of currencies and here are some “exceptions” to my 2-decimal-place assumption:
3 decimal places: Kuwaiti dinar, Jordanian dinar, Bahraini dinar, Omani rial, Libyan dinar, Tunisian dinar
0 decimal places: many, including Iraqi dinar, Icelandic króna, Japanese yen, South Korean won
0.7 decimal places: Malagasy ariary, Mauritanian ouguiya. Yes, 0.7. These two countries divide their unit of currency into five subunits, so Wikipedia wonks decided to get all mathematical and describe this as 10 ^ 0.7 which is approximately 5.
Thank goodness I don’t have to handle the UK’s pre-decimal pounds/shillings/pence.