W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: [css3-lists] CJK numbering algorithms

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 20 Apr 2011 19:13:23 -0700
Message-ID: <4DAF92C3.6000002@inkedblade.net>
To: www-style@w3.org
On 04/20/2011 03:00 PM, fantasai wrote:
> I think the writeup on the CJK numbering systems is really confusing.
> So here's my attempt to refactor. The thing to keep in mind is that
> it's just like our system, except they group by four orders of
> magnitude instead of three.

Ok, here's the revised version based on Tab's answers, Murakami-san's
email <http://lists.w3.org/Archives/Public/www-style/2009Feb/0252.html>
and Sylvain's email
<http://lists.w3.org/Archives/Public/www-style/2010Feb/0153.html>.
Probably somebody need to double-check it, as I'm sure it's wrong
in some cases. But I think this format allows for a universal algorithm
with a few "if" clauses added in to handle the variations.

   1. If the number is zero, use the digit for zero. End algorithm.

                                           [cjk-styles]
        +---------------------------------+-+-+-+-+-+-+-+
        | Digit 0                         |?|?|?|?|?|?|?|
        +---------------------------------+-+-+-+-+-+-+-+

   2. Starting from the right (ones place), split the decimal number
      into groups of four digits.

   3. Append the appropriate group marker to each group whose value
      is not zero. The ones group has no marker.
                                           [cjk-styles]
        +---------------------------------+-+-+-+-+-+-+-+
        | Second Group (Ten-Thousands)    |?|?|?|?|?|?|?|
        | Third  Group (Hundred-Millions) |?|?|?|?|?|?|?|
        | Fourth Group (Trillions)        |?|?|?|?|?|?|?|
        +---------------------------------+-+-+-+-+-+-+-+

   4. Within each group, for each digit that is not 0, append
      the appropriate digit marker. The ones group has no marker.
                                           [cjk-styles]
        +---------------------------------+-+-+-+-+-+-+-+
        | Second Digit (Tens)             |?|?|?|?|?|?|?|
        | Third  Digit (Hundreds)         |?|?|?|?|?|?|?|
        | Fourth Digit (Thousands)        |?|?|?|?|?|?|?|
        +---------------------------------+-+-+-+-+-+-+-+

   5. Replace all digits 1-9 according to the table below.
                                           [cjk-styles]
        +---------------------------------+-+-+-+-+-+-+-+
        | Digit 1                         |?|?|?|?|?|?|?|
        | Digit 2                         |?|?|?|?|?|?|?|
        | Digit 3                         |?|?|?|?|?|?|?|
        | Digit 4                         |?|?|?|?|?|?|?|
        | Digit 5                         |?|?|?|?|?|?|?|
        | Digit 6                         |?|?|?|?|?|?|?|
        | Digit 7                         |?|?|?|?|?|?|?|
        | Digit 8                         |?|?|?|?|?|?|?|
        | Digit 9                         |?|?|?|?|?|?|?|
        +---------------------------------+-+-+-+-+-+-+-+

   6. Simplify:
        * For informal styles, for any group with a value between ten
          and nineteen, remove the digit before the tens marker.
        * For the Japanese and Korean informal styles, if any of
          the digit markers are preceded by the digit 1, and that digit
          is not the first digit of the group, remove the digit, leaving
          only the marker.
        * For Korean informal styles, if the value of the ten-thousands
          group

   7. Collapse (across groups) any consecutive runs of 0 digits into
        * nothing, for Japanese
        * a single _zero digit_, for Chinese
      [Add appropriate prose for Korean]

   9. Insert spaces (U+0020) between groups for the Korean styles.

~fantasai
Received on Thursday, 21 April 2011 02:13:55 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT