Skip to content
Engineering

Why JPY has no decimal places — and what it costs you to get wrong

Treating a zero-decimal currency like a two-decimal one is a 100× error. Here is why minor units differ, and how to stop assuming.

4 min read

Money is not always cents

Most developers internalise "amount × 100" for money because their home currency has two decimal places. The Japanese yen has none — ¥1,235 is a whole number, not 1,235 cents. The Kuwaiti dinar has three. Bahrain, Oman, Tunisia and a handful of others also use three. Assume two and you will charge a Japanese customer 100× too much, or a Kuwaiti 1/10th too little.

ISO 4217 and ICU disagree sometimes

The authoritative minor-unit count lives in ISO 4217, and ICU/CLDR usually matches it — but not always, and hyperinflation currencies drift. LocaleSense returns the real minor-unit count per market and re-derives its formatting from ICU on every build, so a currency that changes convention breaks the build instead of silently shipping a wrong charge.

The safe rule

Never hard-code the number of decimal places. Read it per currency, store money as an integer count of minor units or as a decimal string, and never as a float — a float cannot represent 0.10 exactly, and money math on floats accumulates error.

See it in the API

10,000 free requests a month. No card required.

Get your API key

Keep reading_

More from the blog