March 17, 2013

Counting Large Numbers in Japanese - a PITA

In Japan, the units people use to represent large numbers such as currency differ significantly to the "rest of the world".  Most people are used to decimal units that increase in powers of 3: thousands ($10^3$), millions ($10^6$), billions ($10^9$), trillions ($10^{12}$).  This system, known as the short scale, is also consistent with how numbers are written: as triplets, with a separator (such as a space, comma or otherwise).  Hundreds are a bit of an exception to this pattern.

In Japan, they also have hundreds, but beyond that, the units increase in powers of 4: ten thousand ($10^4$), 100 million ($10^8$), trillion ($10^{12}$).  Unsurprisingly, they have names for these units, too: man (万), oku (憶), and chou (兆), respectively.  They also have thousands ($10^3$), but that's kind of an exception.  They also have the infamous hyaku-man (百万), the hundred ten-thousands.  You may know that as a million.  Despite this "power of four" rule, the Japanese still write numbers as triplets, except using their own units: for example, car prices are often written as 123,000万円 (or 12.3億円, depending on the psychological trick the car dealership believes in).  For a non-Japanese person, that's 1,230,000,000 or 1.23 billion yen.  Simple, right?  All you need to do is mentally add a couple of zeros, shift the commas across, regroup the zeros...

Wrong.  I mess this up all the time, like when I'm reading the news or shopping around for my next BMW.  It happens frequently enough to be frustrating, but not frequently enough to learn my lesson. So, behold: I give you the "The Decimator": a JavaScript that converts Japanese numbers to our familiar decimal notation.