1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 2"https://www.w3.org/TR/html4/loose.dtd"> 3<html> 4<head> 5 <meta name="generator" content= 6 "HTML Tidy for HTML5 for Apple macOS version 5.6.0"> 7 <meta http-equiv="Content-Type" content= 8 "text/html; charset=utf-8"> 9 <meta http-equiv="Content-Language" content="en-us"> 10 <link rel="stylesheet" href= 11 "../reports.css" type="text/css"> 12 <title>UTS #35: Unicode LDML: Numbers</title> 13 <style type="text/css"> 14 <!-- 15 .dtd { 16 font-family: monospace; 17 font-size: 90%; 18 background-color: #CCCCFF; 19 border-style: dotted; 20 border-width: 1px; 21 } 22 23 .xmlExample { 24 font-family: monospace; 25 font-size: 80% 26 } 27 28 .blockedInherited { 29 font-style: italic; 30 font-weight: bold; 31 border-style: dashed; 32 border-width: 1px; 33 background-color: #FF0000 34 } 35 36 .inherited { 37 font-weight: bold; 38 border-style: dashed; 39 border-width: 1px; 40 background-color: #00FF00 41 } 42 43 .element { 44 font-weight: bold; 45 color: red; 46 } 47 48 .attribute { 49 font-weight: bold; 50 color: maroon; 51 } 52 53 .attributeValue { 54 font-weight: bold; 55 color: blue; 56 } 57 58 li, p { 59 margin-top: 0.5em; 60 margin-bottom: 0.5em 61 } 62 63 h2, h3, h4, table { 64 margin-top: 1.5em; 65 margin-bottom: 0.5em; 66 } 67 --> 68 </style> 69</head> 70<body> 71 <table class="header" width="100%"> 72 <tr> 73 <td class="icon"><a href="https://unicode.org"><img alt= 74 "[Unicode]" src="../logo60s2.gif" 75 width="34" height="33" style= 76 "vertical-align: middle; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px; border-top-width: 0px;"></a> 77 <a class="bar" href= 78 "https://www.unicode.org/reports/">Technical Reports</a></td> 79 </tr> 80 <tr> 81 <td class="gray"> </td> 82 </tr> 83 </table> 84 <div class="body"> 85 <h2 style="text-align: center">Unicode Technical Standard #35</h2> 86 <h1>Unicode Locale Data Markup Language (LDML)<br> 87 Part 3: Numbers</h1> 88 <!-- At least the first row of this header table should be identical across the parts of this UTS. --> 89 <table border="1" cellpadding="2" cellspacing="0" class="wide"> 90 <tr> 91 <td>Version</td> 92 <td>38</td> 93 </tr> 94 <tr> 95 <td>Editors</td> 96 <td>John Emmons (<a href= 97 "mailto:emmo@us.ibm.com">emmo@us.ibm.com</a>) and <a href= 98 "tr35.html#Acknowledgments">other CLDR committee 99 members</a></td> 100 </tr> 101 </table> 102 <p>For the full header, summary, and status, see <a href= 103 "tr35.html">Part 1: Core</a></p> 104 <h3><i>Summary</i></h3> 105 <p>This document describes parts of an XML format 106 (<i>vocabulary</i>) for the exchange of structured locale data. 107 This format is used in the <a href= 108 "https://unicode.org/cldr/">Unicode Common Locale Data 109 Repository</a>.</p> 110 <p>This is a partial document, describing only those parts of 111 the LDML that are relevant for number and currency formatting. 112 For the other parts of the LDML see the <a href= 113 "tr35.html">main LDML document</a> and the links above.</p> 114 <h3><i>Status</i></h3> 115 116 <!-- NOT YET APPROVED 117 <p> 118 <i class="changed">This is a<b><font color="#ff3333"> 119 draft </font></b>document which may be updated, replaced, or superseded by 120 other documents at any time. Publication does not imply endorsement 121 by the Unicode Consortium. This is not a stable document; it is 122 inappropriate to cite this document as other than a work in 123 progress. 124 </i> 125 </p> 126 END NOT YET APPROVED --> 127 <!-- APPROVED --> 128 <p><i>This document has been reviewed by Unicode members and 129 other interested parties, and has been approved for publication 130 by the Unicode Consortium. This is a stable document and may be 131 used as reference material or cited as a normative reference by 132 other specifications.</i></p> 133 <!-- END APPROVED --> 134 135 <blockquote> 136 <p><i><b>A Unicode Technical Standard (UTS)</b> is an 137 independent specification. Conformance to the Unicode 138 Standard does not imply conformance to any UTS.</i></p> 139 </blockquote> 140 <p><i>Please submit corrigenda and other comments with the CLDR 141 bug reporting form [<a href="tr35.html#Bugs">Bugs</a>]. Related 142 information that is useful in understanding this document is 143 found in the <a href="tr35.html#References">References</a>. For 144 the latest version of the Unicode Standard see [<a href= 145 "tr35.html#Unicode">Unicode</a>]. For a list of current Unicode 146 Technical Reports see [<a href= 147 "tr35.html#Reports">Reports</a>]. For more information about 148 versions of the Unicode Standard, see [<a href= 149 "tr35.html#Versions">Versions</a>].</i></p> 150 <!-- This section of Parts should be identical in all of the parts of this UTS. --> 151 <h2><a name="Parts" href="#Parts" id="Parts">Parts</a></h2> 152 <p>The LDML specification is divided into the following 153 parts:</p> 154 <ul class="toc"> 155 <li>Part 1: <a href="tr35.html#Contents">Core</a> (languages, 156 locales, basic structure)</li> 157 <li>Part 2: <a href="tr35-general.html#Contents">General</a> 158 (display names & transforms, etc.)</li> 159 <li>Part 3: <a href="tr35-numbers.html#Contents">Numbers</a> 160 (number & currency formatting)</li> 161 <li>Part 4: <a href="tr35-dates.html#Contents">Dates</a> 162 (date, time, time zone formatting)</li> 163 <li>Part 5: <a href= 164 "tr35-collation.html#Contents">Collation</a> (sorting, 165 searching, grouping)</li> 166 <li>Part 6: <a href= 167 "tr35-info.html#Contents">Supplemental</a> (supplemental 168 data)</li> 169 <li>Part 7: <a href= 170 "tr35-keyboards.html#Contents">Keyboards</a> (keyboard 171 mappings)</li> 172 </ul> 173 <h2><a name="Contents" href="#Contents" id="Contents">Contents 174 of Part 3, Numbers</a></h2> 175 <!-- START Generated TOC: CheckHtmlFiles --> 176 <ul class="toc"> 177 <li>1 <a href="#Numbering_Systems">Numbering Systems</a></li> 178 <li>2 <a href="#Number_Elements">Number Elements</a> 179 <ul class="toc"> 180 <li>2.1 <a href="#defaultNumberingSystem">Default 181 Numbering System</a></li> 182 <li>2.2 <a href="#otherNumberingSystems">Other Numbering 183 Systems</a></li> 184 <li>2.3 <a href="#Number_Symbols">Number Symbols</a></li> 185 <li>2.4 <a href="#Number_Formats">Number Formats</a> 186 <ul class="toc"> 187 <li>2.4.1 <a href="#Compact_Number_Formats">Compact 188 Number Formats</a></li> 189 <li>2.4.2 <a href="#Currency_Formats">Currency 190 Formats</a></li> 191 </ul> 192 </li> 193 <li>2.5 <a href="#Miscellaneous_Patterns">Miscellaneous 194 Patterns</a></li> 195 <li>2.6 <a href="#Minimal_Pairs">Minimal Pairs</a></li> 196 </ul> 197 </li> 198 <li>3 <a href="#Number_Format_Patterns">Number Format 199 Patterns</a> 200 <ul class="toc"> 201 <li>3.1 <a href="#Number_Patterns">Number Patterns</a> 202 <ul class="toc"> 203 <li>Table: <a href="#Number_Pattern_Examples">Number 204 Pattern Examples</a></li> 205 </ul> 206 </li> 207 <li>3.2 <a href="#Special_Pattern_Characters">Special 208 Pattern Characters</a> 209 <ul class="toc"> 210 <li>Table: <a href= 211 "#Number_Pattern_Character_Definitions">Number 212 Pattern Character Definitions</a></li> 213 <li>Table: <a href= 214 "#Sample_Patterns_and_Results">Sample Patterns and 215 Results</a></li> 216 <li>Table: <a href= 217 "#Examples_of_minimumGroupingDigits">Examples of 218 minimumGroupingDigits</a></li> 219 <li>3.2.1 <a href="#Explicit_Plus">Explicit Plus 220 Signs</a></li> 221 </ul> 222 </li> 223 <li>3.3 <a href="#Formatting">Formatting</a></li> 224 <li>3.4 <a href="#sci">Scientific Notation</a></li> 225 <li>3.5 <a href="#sigdig">Significant Digits</a> 226 <ul class="toc"> 227 <li>Table: <a href= 228 "#Significant_Digits_Examples">Significant Digits 229 Examples</a></li> 230 </ul> 231 </li> 232 <li>3.6 <a href="#Padding">Padding</a></li> 233 <li>3.7 <a href="#Rounding">Rounding</a></li> 234 <li>3.8 <a href="#Quoting_Rules">Quoting Rules</a></li> 235 </ul> 236 </li> 237 <li>4 <a href="#Currencies">Currencies</a> 238 <ul class="toc"> 239 <li>4.1 <a href= 240 "#Supplemental_Currency_Data">Supplemental Currency 241 Data</a></li> 242 </ul> 243 </li> 244 <li>5 <a href="#Language_Plural_Rules">Language Plural 245 Rules</a> 246 <ul class="toc"> 247 <li>5.1 <a href="#Plural_rules_syntax">Plural rules 248 syntax</a> 249 <ul class="toc"> 250 <li>5.1.1 <a href="#Operands">Operands</a> 251 <ul class="toc"> 252 <li>Table: <a href= 253 "#Plural_Operand_Meanings">Plural Operand 254 Meanings</a></li> 255 <li>Table: <a href= 256 "#Plural_Operand_Examples">Plural Operand 257 Examples</a></li> 258 </ul> 259 </li> 260 <li>5.1.2 <a href="#Relations">Relations</a> 261 <ul class="toc"> 262 <li>Table: <a href= 263 "#Relations_Examples">Relations Examples</a></li> 264 <li>Table: <a href= 265 "#Plural_Rules_Examples">Plural Rules 266 Examples</a></li> 267 </ul> 268 </li> 269 <li>5.1.3 <a href="#Samples">Samples</a> 270 <ul class="toc"> 271 <li>Table: <a href= 272 "#Plural_Samples_Examples">Plural Samples 273 Examples</a></li> 274 </ul> 275 </li> 276 <li>5.1.4 <a href="#Using_cardinals">Using 277 Cardinals</a></li> 278 </ul> 279 </li> 280 <li>5.2 <a href="#Plural_Ranges">Plural Ranges</a></li> 281 </ul> 282 </li> 283 <li>6 <a href="#Rule-Based_Number_Formatting">Rule-Based 284 Number Formatting</a></li> 285 <li>7 <a href="#Parsing_Numbers">Parsing Numbers</a></li> 286 </ul><!-- END Generated TOC: CheckHtmlFiles --> 287 <h2><a name="Numbering_Systems" href="#Numbering_Systems" id= 288 "Numbering_Systems">1 Numbering Systems</a></h2> 289 <p class="dtd"><!ELEMENT numberingSystems ( numberingSystem* 290 ) ><br> 291 <!ELEMENT numberingSystem EMPTY ><br> 292 <!ATTLIST numberingSystem id NMTOKEN #REQUIRED ><br> 293 <!ATTLIST numberingSystem type ( numeric | algorithmic ) 294 #REQUIRED ><br> 295 <!ATTLIST numberingSystem radix NMTOKEN #IMPLIED ><br> 296 <!ATTLIST numberingSystem digits CDATA #IMPLIED ><br> 297 <!ATTLIST numberingSystem rules CDATA #IMPLIED ><br></p> 298 <p>Numbering systems information is used to define different 299 representations for numeric values to an end user. Numbering 300 systems are defined in CLDR as one of two different types: 301 algorithmic and numeric. Numeric systems are simply a decimal 302 based system that uses a predefined set of digits to represent 303 numbers. Examples are Western ( ASCII digits ), Thai digits, 304 Devanagari digits. Algorithmic systems are more complex in 305 nature, since the proper formatting and presentation of a 306 numeric quantity is based on some algorithm or set of rules. 307 Examples are Chinese numerals, Hebrew numerals, or Roman 308 numerals. In CLDR, the rules for presentation of numbers in an 309 algorithmic system are defined using the RBNF syntax described 310 in <i><a href="#Rule-Based_Number_Formatting">Section 6: 311 Rule-Based Number Formatting</a></i>.</p> 312 <p>Attributes for the <numberingSystem> element are as 313 follows:</p> 314 <blockquote> 315 <p><span class="attribute">id</span> - Specifies the name of 316 the numbering system that can be used to designate its use in 317 formatting.</p> 318 <p><span class="attribute">type</span> - Specifies whether 319 the numbering system is algorithmic or numeric.</p> 320 <p><span class="attribute">digits</span> - For numeric 321 systems, specifies the digits used to represent numbers, in 322 order, starting from zero.</p> 323 <p><span class="attribute">rules</span> - Specifies the RBNF 324 ruleset to be used for formatting numbers from this numbering 325 system. The rules specifier can contain simply a ruleset 326 name, in which case the ruleset is assumed to be found in the 327 rule set grouping "NumberingSystemRules". Alternatively, the 328 specifier can denote a specific locale, ruleset grouping, and 329 ruleset name, separated by slashes.</p> 330 </blockquote> 331 <p>Examples:</p> 332 <pre> 333 <numberingSystem id="latn" type="numeric" digits="0123456789"/> 334<!-- ASCII digits - A numeric system --></pre> 335 <pre> 336 <numberingSystem id="thai" type="numeric" digits="๐๑๒๓๔๕๖๗๘๙"/> 337<!-- A numeric system using Thai digits --></pre> 338 <pre> 339 <numberingSystem id="geor" type="algorithmic" rules="georgian"/> 340<!-- An algorithmic system - Georgian numerals , rules found in NumberingSystemRules --></pre> 341 <pre> 342 <numberingSystem id="hant" type="algorithmic" rules="zh_Hant/SpelloutRules/spellout-cardinal"/> 343<!-- An algorithmic system. Traditional Chinese Numerals --> 344</pre>For general information about the numbering system data, 345including the BCP47 identifiers, see the main document <em>Section 346Q.1.1 <a href="tr35.html#Numbering%20System%20Data">Numbering 347System Data</a>.</em> ) ><br> 348 <h2><a name="Number_Elements" href="#Number_Elements" id= 349 "Number_Elements">2 Number Elements</a></h2> 350 <p class="dtd"><!ELEMENT numbers ( alias | ( 351 defaultNumberingSystem*, otherNumberingSystems*, 352 minimumGroupingDigits*, symbols*, decimalFormats*, 353 scientificFormats*, percentFormats*, currencyFormats*, 354 currencies?, miscPatterns*, minimalPairs*, special* ) ) 355 ></p> 356 <p>The numbers element supplies information for formatting and 357 parsing numbers and currencies. It has the following 358 sub-elements: <defaultNumberingSystem>, 359 <otherNumberingSystems>, <symbols>, 360 <decimalFormats>, <scientificFormats>, 361 <percentFormats>, <currencyFormats>, and 362 <currencies>. The currency IDs are from [<a href= 363 "tr35.html#ISO4217">ISO4217</a>] (plus some additional 364 common-use codes). For more information, including the pattern 365 structure, see <i><a href="#Number_Format_Patterns">Section 3: 366 Number Format Patterns</a></i>.</p> 367 <h3>2.1 <a name="defaultNumberingSystem" href= 368 "#defaultNumberingSystem" id="defaultNumberingSystem">Default 369 Numbering System</a></h3> 370 <p><span class="dtd"><!ELEMENT defaultNumberingSystem ( 371 #PCDATA )></span></p> 372 <p>This element indicates which numbering system should be used 373 for presentation of numeric quantities in the given locale.</p> 374 <h3>2.2 <a name="otherNumberingSystems" href= 375 "#otherNumberingSystems" id="otherNumberingSystems">Other 376 Numbering Systems</a></h3> 377 <p><span class="dtd"><!ELEMENT otherNumberingSystems ( alias 378 | ( native*, traditional*, finance*)) ></span></p> 379 <p>This element defines general categories of numbering systems 380 that are sometimes used in the given locale for formatting 381 numeric quantities. These additional numbering systems are 382 often used in very specific contexts, such as in calendars or 383 for financial purposes. There are currently three defined 384 categories, as follows:</p> 385 <dl> 386 <dt><b>native</b></dt> 387 <dd>Defines the numbering system used for the native digits, 388 usually defined as a part of the script used to write the 389 language. The native numbering system can only be a numeric 390 positional decimal-digit numbering system, using digits with 391 General_Category=Decimal_Number. Note: In locales where the 392 native numbering system is the default, it is assumed that 393 the numbering system "latn" ( Western Digits 0-9 ) is always 394 acceptable, and can be selected using the -nu keyword as part 395 of a Unicode locale identifier.</dd> 396 <dt><b>traditional</b></dt> 397 <dd>Defines the traditional numerals for a locale. This 398 numbering system may be numeric or algorithmic. If the 399 traditional numbering system is not defined, applications 400 should use the native numbering system as a fallback.</dd> 401 <dt><b>finance</b></dt> 402 <dd>Defines the numbering system used for financial 403 quantities. This numbering system may be numeric or 404 algorithmic. This is often used for ideographic languages 405 such as Chinese, where it would be easy to alter an amount 406 represented in the default numbering system simply by adding 407 additional strokes. If the financial numbering system is not 408 specified, applications should use the default numbering 409 system as a fallback.</dd> 410 </dl> 411 <p>The categories defined for other numbering systems can be 412 used in a Unicode locale identifier to select the proper 413 numbering system without having to know the specific numbering 414 system by name. For example:</p> 415 <ul> 416 <li>To select Hindi language using the native digits for 417 numeric formatting, use locale ID: "hi-IN-u-nu-native".</li> 418 <li>To select Chinese language using the appropriate 419 financial numerals, use locale ID: "zh-u-nu-finance".</li> 420 <li>To select Tamil language using the traditional Tamil 421 numerals, use locale ID: "ta-u-nu-traditio".</li> 422 <li>To select Arabic language using western digits 0-9, use 423 locale ID: "ar-u-nu-latn".</li> 424 </ul> 425 <p>For more information on numbering systems and their 426 definitions, see <i><a href="#Numbering_Systems">Section 1: 427 Numbering Systems</a></i>.</p> 428 <h3>2.3 <a name="Number_Symbols" href="#Number_Symbols" id= 429 "Number_Symbols">Number Symbols</a></h3> 430 <p class="dtd"><!ELEMENT symbols (alias | (decimal*, group*, 431 list*, percentSign*, nativeZeroDigit*, patternDigit*, 432 plusSign*, minusSign*, approximatelySign*, exponential*, 433 superscriptingExponent*, perMille*, infinity*, nan*, currencyDecimal*, 434 currencyGroup*, timeSeparator*, special*)) ></p> 435 <p>Number symbols define the localized symbols that are 436 commonly used when formatting numbers in a given locale. These 437 symbols can be referenced using a number formatting pattern as 438 defined in <i><a href="#Number_Format_Patterns">Section 3: 439 Number Format Patterns</a></i>.</p> 440 <p>The available number symbols are as follows:</p> 441 <dl> 442 <dt><b>decimal</b></dt> 443 <dd>- separates the integer and fractional part of the 444 number.</dd> 445 <dt><b>group</b></dt> 446 <dd>- separates clusters of integer digits to make large 447 numbers more legible; commonly used for thousands (grouping 448 size 3, e.g. "100,000,000") or in some locales, ten-thousands 449 (grouping size 4, e.g. "1,0000,0000"). There may be two 450 different grouping sizes: The <em>primary grouping size</em> 451 used for the least significant integer group, and the 452 <em>secondary grouping size</em> used for more significant 453 groups; these are not the same in all locales (e.g. 454 "12,34,56,789"). If a pattern contains multiple grouping 455 separators, the interval between the last one and the end of 456 the integer defines the primary grouping size, and the 457 interval between the last two defines the secondary grouping 458 size. All others are ignored, so "#,##,###,####" == 459 "###,###,####" == "##,#,###,####".</dd> 460 <dt><b>list</b></dt> 461 <dd>- symbol used to separate numbers in a list intended to 462 represent structured data such as an array; must be different 463 from the <b>decimal</b> value. This list separator is for 464 “non-linguistic” usage as opposed to the listPatterns for 465 “linguistic” lists (e.g. “Bob, Carol, and Ted”) described in 466 Part 2, <em>Section 11 <a href= 467 "tr35-general.html#ListPatterns">List Patterns</a></em>.</dd> 468 <dt><b>percentSign</b></dt> 469 <dd>- symbol used to indicate a percentage (1/100th) amount. 470 (If present, the value is also multiplied by 100 before 471 formatting. That way 1.23 → 123%)</dd> 472 <dt><b>nativeZeroDigit</b></dt> 473 <dd>- Deprecated - do not use.</dd> 474 <dt><b>patternDigit</b></dt> 475 <dd>- Deprecated. This was formerly used to provide the 476 localized pattern character corresponding to '#', but 477 localization of the pattern characters themselves has been 478 deprecated for some time (determining the locale-specific 479 <em>replacements</em> for pattern characters is of course not 480 deprecated and is part of normal number formatting).</dd> 481 <dt><b>minusSign</b></dt> 482 <dd>- Symbol used to denote negative value.</dd> 483 <dt><b>plusSign</b></dt> 484 <dd>- Symbol used to denote positive value. It can be 485 used to produce modified patterns, so that 3.12 is formatted 486 as "+3.12", for example. The standard number patterns (except 487 for type="accounting") will contain the minusSign, explicitly 488 or implicitly. In the explicit pattern, the value of the 489 plusSign can be substituted for the value of the minusSign to 490 produce a pattern that has an explicit plus sign.</dd> 491 <dt><b>approximatelySign</b></dt> 492 <dd>- Symbol used to denote a value that is approximate but 493 not exact. The symbol is substituted in place of the minusSign 494 using the same semantics as plusSign substitution.</dd> 495 <dt><b>exponential</b></dt> 496 <dd>- Symbol separating the mantissa and exponent 497 values.</dd> 498 <dt><b>superscriptingExponent</b></dt> 499 <dd>- (Programmers are used to the fallback exponent style 500 “1.23E4”, but that should not be shown to end-users. Instead, 501 the exponential notation superscriptingExponent should be 502 used to show a format like “1.23 × 10<sup>4</sup>”. ) The 503 superscripting can use markup, such as 504 <sup>4</sup> in HTML, or for the special case of 505 Latin digits, use the superscript characters: U+207B ( ⁻ ), 506 U+2070 ( ⁰ ), U+00B9 ( ¹ ), U+00B2 ( ² ), U+00B3 ( ³ ), 507 U+2074 ( ⁴ ) .. U+2079 ( ⁹ ).</dd> 508 <dt><b>perMille</b></dt> 509 <dd>- symbol used to indicate a per-mille (1/1000th) amount. 510 (If present, the value is also multiplied by 1000 before 511 formatting. That way 1.23 → 1230 [1/000])</dd> 512 <dt><b>infinity</b></dt> 513 <dd>- The infinity sign. Corresponds to the IEEE infinity bit 514 pattern.</dd> 515 <dt><b>nan - Not a number</b></dt> 516 <dd>- The NaN sign. Corresponds to the IEEE NaN bit 517 pattern.</dd> 518 <dt><b>currencyDecimal</b></dt> 519 <dd>- Optional. If specified, then for currency 520 formatting/parsing this is used as the decimal separator 521 instead of using the regular decimal separator; otherwise, 522 the regular decimal separator is used.</dd> 523 <dt><b>currencyGroup</b></dt> 524 <dd>- Optional. If specified, then for currency 525 formatting/parsing this is used as the group separator 526 instead of using the regular group separator; otherwise, the 527 regular group separator is used.</dd> 528 <dt><b>timeSeparator</b></dt> 529 <dd> 530 - This replaces any use of the timeSeparator pattern 531 character in a date-time format pattern (no timeSeparator 532 pattern character is currently defined, see note below). 533 This allows the same time format to be used for multiple 534 number systems when the time separator depends on the 535 number system. For example, the time format for Arabic 536 should be COLON when using the Latin numbering system (0, 537 1, 2, …), but when the Arabic numbering system is used (٠ 538 - ١ - ٢ …), the traditional time separator in older print 539 styles was often ARABIC COMMA. 540 <p class="note"><b>Note:</b> In CLDR 26 the timeSeparator 541 pattern character was specified to be COLON. This was 542 withdrawn in CLDR 28 due to backward compatibility issues, 543 and no timeSeparator pattern character is currently 544 defined. No CLDR locales are known to have a need to 545 specify timeSeparator symbols that depend on number system; 546 if this changes in the future a different timeSeparator 547 pattern character will be defined. In 548 the meantime, since CLDR data consumers can still request 549 the timeSeparator symbol. it should match the symbol 550 actually used in the 551 <a href="tr35-dates.html#timeFormats">timeFormats</a> and 552 <a href="tr35-dates.html#availableFormats_appendItems">availableFormats</a> 553 items.</p> 554 </dd> 555 </dl> 556 <p>Example:</p> 557 <pre><symbols> 558 <decimal><span style= 559"color: blue">.</span></decimal> 560 <group><span style="color: blue">,</span></group> 561 <list><span style="color: blue">;</span></list> 562 <percentSign><span style= 563"color: blue">%</span></percentSign> 564 <patternDigit><span style= 565"color: blue">#</span></patternDigit> 566 <plusSign><span style= 567"color: blue">+</span></plusSign> 568 <minusSign><span style= 569"color: blue">-</span></minusSign> 570 <approximatelySign><span style= 571"color: blue">~</span></approximatelySign> 572 <exponential><span style= 573"color: blue">E</span></exponential> 574 <superscriptingExponent><span style= 575"color: blue">×</span></superscriptingExponent> 576 <perMille><span style= 577"color: blue">‰</span></perMille> 578 <infinity><span style= 579"color: blue">∞</span></infinity> 580 <nan><span style="color: blue">☹</span></nan> 581 <timeSeparator>:</timeSeparator> 582</symbols></pre> 583 <p><span class="dtd"><!ATTLIST symbols numberSystem CDATA 584 #IMPLIED ><br></span> The numberSystem attribute is used to 585 specify that the given number symbols are to be used when the 586 given numbering system is active. Number symbols can only be 587 defined for numbering systems of the "numeric" type, since any 588 special symbols required for an algorithmic numbering system 589 should be specified by the RBNF formatting rules used for that 590 numbering system. By default, number symbols without a specific 591 numberSystem attribute are assumed to be used for the "latn" 592 numbering system, which is western (ASCII) digits. Locales that 593 specify a numbering system other than "latn" as the default 594 should also specify number formatting symbols that are 595 appropriate for use within the context of the given numbering 596 system. For example, a locale that uses the Arabic-Indic digits 597 as its default would likely use an Arabic comma for the 598 grouping separator rather than the ASCII comma.<br> 599 For more information on numbering systems and their 600 definitions, see <i><a href="#Numbering_Systems">Section 1: 601 Numbering Systems</a></i>.</p> 602 <h3>2.4 <a name="Number_Formats" href="#Number_Formats" id= 603 "Number_Formats">Number Formats</a></h3> 604 <p class="dtd"><!ELEMENT decimalFormats (alias | (default*, 605 decimalFormatLength*, special*))><br> 606 <!ELEMENT decimalFormatLength (alias | (default*, 607 decimalFormat*, special*))><br> 608 <!ATTLIST decimalFormatLength type ( full | long | medium | 609 short ) #IMPLIED ><br> 610 <!ELEMENT decimalFormat (alias | (pattern*, special*)) 611 ><br></p> 612 <p>(scientificFormats, percentFormats have the same 613 structure)</p> 614 <p>Number formats are used to define the rules for formatting 615 numeric quantities using the pattern syntax described in 616 <i><a href="#Number_Format_Patterns">Section 3: Number Format 617 Patterns</a></i>.</p> 618 <p>Different formats are provided for different contexts, as 619 follows:</p> 620 <dl> 621 <dt> </dt> 622 <dt><b>decimalFormats</b></dt> 623 <dd>The normal locale specific way to write a base 10 number. 624 Variations of the decimalFormat pattern are provided that 625 allow compact number formatting.</dd> 626 <dt><b>percentFormats</b></dt> 627 <dd>Pattern for use with percentage formatting</dd> 628 <dt><b>scientificFormats</b></dt> 629 <dd>Pattern for use with scientific (exponent) 630 formatting.</dd> 631 </dl> 632 <p>Example:</p> 633 <pre><decimalFormats> 634 <decimalFormatLength type="<span style= 635"color: blue">long</span>"> 636 <decimalFormat> 637 <pattern><span style= 638"color: blue">#,##0.###</span></pattern> 639 </decimalFormat> 640 </decimalFormatLength> 641</decimalFormats></pre> 642 <pre><scientificFormats> 643 <default type="<span style="color: blue">long</span>"/> 644 <scientificFormatLength type="<span style= 645"color: blue">long</span>"> 646 <scientificFormat> 647 <pattern><span style= 648"color: blue">0.000###E+00</span></pattern> 649 </scientificFormat> 650 </scientificFormatLength> 651 <scientificFormatLength type="<span style= 652"color: blue">medium</span>"> 653 <scientificFormat> 654 <pattern><span style= 655"color: blue">0.00##E+00</span></pattern> 656 </scientificFormat> 657 </scientificFormatLength> 658</scientificFormats></pre> 659 <pre><percentFormats> 660 <percentFormatLength type="<span style= 661"color: blue">long</span>"> 662 <percentFormat> 663 <pattern><span style= 664"color: blue">#,##0%</span></pattern> 665 </percentFormat> 666 </percentFormatLength> 667</percentFormats></pre> 668 <p><span class="dtd"><!ATTLIST symbols numberSystem CDATA 669 #IMPLIED ><br></span> The numberSystem attribute is used to 670 specify that the given number formatting pattern(s) are to be 671 used when the given numbering system is active. By default, 672 number formatting patterns without a specific numberSystem 673 attribute are assumed to be used for the "latn" numbering 674 system, which is western (ASCII) digits. Locales that specify a 675 numbering system other than "latn" as the default should also 676 specify number formatting patterns that are appropriate for use 677 within the context of the given numbering system.<br> 678 For more information on numbering systems and their 679 definitions, see <i><a href="#Numbering_Systems">Section 1: 680 Numbering Systems</a></i>.</p> 681 <h4>2.4.1 <a name="Compact_Number_Formats" href= 682 "#Compact_Number_Formats" id="Compact_Number_Formats">Compact 683 Number Formats</a></h4>A pattern type attribute is used for 684 <em>compact number formats</em>, such as the following: 685 <pre> 686<decimalFormatLength type="long"><br> <decimalFormat><br> <pattern type="1000" count="one">0 millier</pattern><br> <pattern type="1000" count="other">0 milliers</pattern><br> <pattern type="10000" count="one">00 mille</pattern><br> <pattern type="10000" count="other">00 mille</pattern><br> <pattern type="100000" count="one">000 mille</pattern><br> <pattern type="100000" count="other">000 mille</pattern><br> <pattern type="1000000" count="one">0 million</pattern><br> <pattern type="1000000" count="other">0 millions</pattern><br> …<br> </decimalFormat><br></decimalFormatLength><br><decimalFormatLength type="short"><br> <decimalFormat><br> <pattern type="1000" count="one">0 K</pattern><br> <pattern type="1000" count="other">0 K</pattern><br> <pattern type="10000" count="one">00 K</pattern><br> <pattern type="10000" count="other">00 K</pattern><br> <pattern type="100000" count="one">000 K</pattern><br> <pattern type="100000" count="other">000 K</pattern><br> <pattern type="1000000" count="one">0 M</pattern><br> <pattern type="1000000" count="other">0 M</pattern><br> …<br> </decimalFormat> 687… 688<currencyFormatLength type="short"><br> <currencyFormat type="standard"><br> <pattern type="1000" count="one">0 K ¤</pattern><br> <pattern type="1000" count="other">0 K ¤</pattern><br> <pattern type="10000" count="one">00 K ¤</pattern><br> <pattern type="10000" count="other">00 K ¤</pattern><br> <pattern type="100000" count="one">000 K ¤</pattern><br> <pattern type="100000" count="other">000 K ¤</pattern><br> <pattern type="1000000" count="one">0 M ¤</pattern><br> <pattern type="1000000" count="other">0 M ¤</pattern></pre> 689 <p>Formats can be supplied for numbers (as above) or for 690 currencies or other units. They can also be used with ranges of 691 numbers, resulting in formatting strings like “$10K” or 692 “$3–7M”.</p> 693 <p>To format a number N, the greatest type less than or equal 694 to N is used, with the appropriate plural category. N is 695 divided by the type, after removing the number of zeros in the 696 pattern, less 1. APIs supporting this format should provide 697 control over the number of significant or fraction digits.</p> 698 <p>The default pattern for any type that is not supplied is the 699 special value “0”, as in the following. The value “0” must be 700 used when a child locale overrides a parent locale to drop the 701 compact pattern for that type and use the default pattern.</p> 702 <p><code> <pattern type="1" 703 count="one">0</pattern></code></p> 704 <p>If the value is precisely “0”, either explicit or defaulted, 705 then the normal number format pattern for that sort of object 706 is supplied — either <decimalFormat> or 707 <currencyFormat type="standard"> — with the normal 708 formatting for the locale (such as the grouping separators). 709 However, for the “0” case by default the signficant digits are 710 adjusted for consistency, typically to 2 or 3 digits, and the 711 maximum fractional digits are set to 0 (for both currencies and 712 plain decimal). Thus the output would be $12, not $12.01. APIs 713 may, however, allow these default behaviors to be 714 overridden.</p> 715 <p>With the data above, N=12345 matches <code><pattern 716 type="10000" count="other">00 K</pattern></code> . N 717 is divided by 1000 (obtained from10000 after removing "00" and 718 restoring one "0". The result is formatted according to the 719 normal decimal pattern. With no fractional digits, that yields 720 "12 K".</p> 721 <p>Formatting 1200 in USD would result in “1.2 K $”, while 990 722 implicitly maps to the special value “0”, which maps to 723 <currencyFormat 724 type="standard"><pattern>#,##0.00 ¤</pattern>, 725 and would result in simply “990 $”.</p> 726 <p>The short format is designed for UI environments where space 727 is at a premium, and should ideally result in a formatted 728 string no more than about 6 em wide (with no fractional 729 digits).</p> 730 <h4>2.4.2 <a name="Currency_Formats" href="#Currency_Formats" 731 id="Currency_Formats">Currency Formats</a></h4> 732 <p>Pattern for use with currency formatting. This format 733 contains a few additional structural options that allow proper 734 placement of the currency symbol relative to the numeric 735 quantity. Refer to <i><a href="#Currencies">Section 4 - 736 Currencies</a></i> for additional information on the use of 737 these options.</p> 738 <p class="dtd"><!ELEMENT currencyFormats (alias | (default*, 739 currencySpacing*, currencyFormatLength*, unitPattern*, 740 special*)) ><br> 741 <!ELEMENT currencySpacing (alias | (beforeCurrency*, 742 afterCurrency*, special*)) ><br> 743 <!ELEMENT beforeCurrency (alias | (currencyMatch*, 744 surroundingMatch*, insertBetween*)) ><br> 745 <!ELEMENT afterCurrency (alias | (currencyMatch*, 746 surroundingMatch*, insertBetween*)) ><br> 747 <!ELEMENT currencyMatch ( #PCDATA ) ><br> 748 <!ELEMENT surroundingMatch ( #PCDATA )) ><br> 749 <!ELEMENT insertBetween ( #PCDATA ) ><br> 750 <!ELEMENT currencyFormatLength (alias | (default*, 751 currencyFormat*, special*)) ><br> 752 <!ATTLIST currencyFormatLength type ( full | long | medium | 753 short ) #IMPLIED ><br> 754 <!ELEMENT currencyFormat (alias | (pattern*, special*)) 755 ></p> 756 <p>In addition to a standard currency format, in which negative 757 currency amounts might typically be displayed as something like 758 “-$3.27”, locales may provide an "accounting" form, in which 759 for "en_US" the same example would appear as “($3.27)”.</p> 760 <pre><currencyFormats> 761 <currencyFormatLength> 762 <currencyFormat type="standard"> 763 <pattern><span style= 764"color: blue">¤#,##0.00</span></pattern> 765 </currencyFormat> 766 <currencyFormat type="accounting"> 767 <pattern><span style= 768"color: blue">¤#,##0.00;(¤#,##0.00)</span></pattern> 769 </currencyFormat> 770 </currencyFormatLength> 771</currencyFormats></pre> 772 <h3>2.5 <a name="Miscellaneous_Patterns" href= 773 "#Miscellaneous_Patterns" id= 774 "Miscellaneous_Patterns">Miscellaneous Patterns</a></h3> 775 <p class="dtd"><!ELEMENT miscPatterns (alias | (default*, 776 pattern*, special*)) ><br> 777 <!ATTLIST miscPatterns numberSystem CDATA #IMPLIED ></p> 778 <p>The miscPatterns supply additional patterns for special 779 purposes. The currently defined values are:</p> 780 <dl> 781 <dt><strong>approximately</strong></dt> 782 <dd>indicates an approximate number, such as: “~99”</dd> 783 <dt><strong>atMost</strong></dt> 784 <dd>indicates a number or lower, such as: “<code>≤</code>99” 785 to indicate that there are 99 items or fewer.</dd> 786 <dt><strong>atLeast</strong></dt> 787 <dd>indicates a number or higher, such as: “99+” to indicate 788 that there are 99 items or more.</dd> 789 <dt><strong>range</strong></dt> 790 <dd>indicates a range of numbers, such as: “99–103” to 791 indicate that there are from 99 to 103 items.</dd> 792 </dl> 793 <p><em>For example:</em></p> 794 <p><code><miscPatterns numberSystem="…"><br> 795 <pattern 796 type="approximately">~{0}</pattern><br> 797 <pattern type="atLeast">≥{0}</pattern><br> 798 <pattern 799 type="atMost">≤{0}</pattern><br> 800 <pattern type="range">{0}–{1}</pattern><br> 801 </miscPatterns></code></p> 802 <h3>2.6 <a name="Minimal_Pairs" href="#Minimal_Pairs" id= 803 "Minimal_Pairs">Minimal Pairs</a></h3> 804 <p class="dtd"><!ELEMENT minimalPairs ( alias | ( pluralMinimalPairs*, ordinalMinimalPairs*, caseMinimalPairs*, genderMinimalPairs*, special* ) ) ><br> 805 </p> 806 <p class="dtd"><!ELEMENT pluralMinimalPairs ( #PCDATA ) 807 ><br> 808 <!ATTLIST pluralMinimalPairs count NMTOKEN #IMPLIED ><br> 809 </p> 810 <p class="dtd"><!ELEMENT ordinalMinimalPairs ( #PCDATA ) 811 ><br> 812 <!ATTLIST ordinalMinimalPairs ordinal NMTOKEN #IMPLIED 813 ><br> 814 </p> 815 <p class="dtd"><!ELEMENT caseMinimalPairs ( #PCDATA ) ><br> 816 <!ATTLIST caseMinimalPairs case NMTOKEN #REQUIRED ></p> 817 <p class="dtd"><!ELEMENT genderMinimalPairs ( #PCDATA ) > <br> 818 <!ATTLIST genderMinimalPairs gender NMTOKEN #REQUIRED ></p> 819 <p>Minimal pairs provide examples that justify why multiple 820 plural or ordinal categories exist, and for providing contextual 821 examples for verifying consistency of translations. The allowable values for the count, 822 ordinal, case, and gender attributes are found in the dtd file.</p> 823 <p>Examples</p> 824 <p><code><minimalPairs><br> 825 <pluralMinimalPairs count="one">{0} Tag</pluralMinimalPairs><br> 826 <pluralMinimalPairs count="other">{0} Tage</pluralMinimalPairs><br> 827<br> 828 <ordinalMinimalPairs ordinal="other">{0}. Abzweigung nach rechts nehmen</ordinalMinimalPairs><br> 829<br> 830 <caseMinimalPairs case="accusative">… für {0} …</caseMinimalPairs><br> 831 <caseMinimalPairs case="dative">… mit {0} …</caseMinimalPairs><br> 832 <caseMinimalPairs case="genitive">Anstatt {0} …</caseMinimalPairs><br> 833 <caseMinimalPairs case="nominative">{0} kostet (kosten) € 3,50.</caseMinimalPairs><br> 834<br> 835 <genderMinimalPairs gender="feminine">Die {0} ist …</genderMinimalPairs><br> 836 <genderMinimalPairs gender="masculine">Der {0} ist …</genderMinimalPairs><br> 837 <genderMinimalPairs gender="neuter">Das {0} ist …</genderMinimalPairs><br> 838 </minimalPairs></code></p> 839 <br> 840 <p>For more information, see <a href="http://cldr.unicode.org/index/cldr-spec/plural-rules">Plural Rules</a> 841 and 842 <a href="http://cldr.unicode.org/translation/grammatical-inflection">Grammatical Inflection</a>.</p> 843 844 <h2><a name="Number_Format_Patterns" href= 845 "#Number_Format_Patterns" id="Number_Format_Patterns">3 Number 846 Format Patterns</a></h2> 847 <h3>3.1 <a name="Number_Patterns" href="#Number_Patterns" id= 848 "Number_Patterns">Number Patterns</a></h3> 849 <p>Number patterns affect how numbers are interpreted in a 850 localized context. Here are some examples, based on the French 851 locale. The "." shows where the decimal point should go. The 852 "," shows where the thousands separator should go. A "0" 853 indicates zero-padding: if the number is too short, a zero (in 854 the locale's numeric set) will go there. A "#" indicates no 855 padding: if the number is too short, nothing goes there. A "¤" 856 shows where the currency sign will go. The following 857 illustrates the effects of different patterns for the French 858 locale, with the number "1234.567". Notice how the pattern 859 characters ',' and '.' are replaced by the characters 860 appropriate for the locale.</p> 861 <blockquote> 862 <table cellspacing="0" cellpadding="4" border="1"> 863 <caption> 864 <a name="Number_Pattern_Examples" href= 865 "#Number_Pattern_Examples" id= 866 "Number_Pattern_Examples">Number Pattern Examples</a> 867 </caption> 868 <tr bgcolor="#CCCCFF"> 869 <th width="17%">Pattern</th> 870 <th width="16%">Currency</th> 871 <th width="33%">Text</th> 872 </tr> 873 <tr> 874 <td width="17%">#,##0.##</td> 875 <td width="16%"><i>n/a</i></td> 876 <td width="33%">1 234,57</td> 877 </tr> 878 <tr> 879 <td width="17%">#,##0.###</td> 880 <td width="16%"><i>n/a</i></td> 881 <td width="33%">1 234,567</td> 882 </tr> 883 <tr> 884 <td width="17%">###0.#####</td> 885 <td width="16%"><i>n/a</i></td> 886 <td width="33%">1234,567</td> 887 </tr> 888 <tr> 889 <td width="17%">###0.0000#</td> 890 <td width="16%"><i>n/a</i></td> 891 <td width="33%">1234,5670</td> 892 </tr> 893 <tr> 894 <td width="17%">00000.0000</td> 895 <td width="16%"><i>n/a</i></td> 896 <td width="33%">01234,5670</td> 897 </tr> 898 <tr> 899 <td width="17%" rowspan="2">#,##0.00 ¤</td> 900 <td width="16%">EUR</td> 901 <td width="33%">1 234,57 €</td> 902 </tr> 903 <tr> 904 <td width="16%">JPY</td> 905 <td width="33%">1 235 ¥JP</td> 906 </tr> 907 </table> 908 </blockquote> 909 <p>The number of # placeholder characters before the decimal do 910 not matter, since no limit is placed on the maximum number of 911 digits. There should, however, be at least one zero someplace 912 in the pattern. In currency formats, the number of digits after 913 the decimal also do not matter, since the information in the 914 supplemental data (see <i><a href= 915 "#Supplemental_Currency_Data">Supplemental Currency 916 Data</a>)</i> is used to override the number of decimal places 917 — and the rounding — according to the currency that is being 918 formatted. That can be seen in the above chart, with the 919 difference between Yen and Euro formatting.</p> 920 <p>To ensure correct layout, especially in currency patterns in 921 which a a variety of symbols may be used, number patterns may 922 contain (invisible) bidirectional text format characters such 923 as LRM, RLM, and ALM.</p> 924 <p><i>When parsing using a pattern, a lenient parse should be 925 used; see <a href="tr35.html#Lenient_Parsing">Lenient 926 Parsing</a>.</i> As noted there, lenient parsing should ignore 927 bidi format characters.</p> 928 <h3>3.2 <a name="Special_Pattern_Characters" href= 929 "#Special_Pattern_Characters" id= 930 "Special_Pattern_Characters">Special Pattern 931 Characters</a></h3> 932 <p>Many characters in a pattern are taken literally; they are 933 matched during parsing and output unchanged during formatting. 934 Special characters, on the other hand, stand for other 935 characters, strings, or classes of characters. For example, the 936 '#' character is replaced by a localized digit for the chosen 937 numberSystem. Often the replacement character is the same as 938 the pattern character; in the U.S. locale, the ',' grouping 939 character is replaced by ','. However, the replacement is still 940 happening, and if the symbols are modified, the grouping 941 character changes. Some special characters affect the behavior 942 of the formatter by their presence; for example, if the percent 943 character is seen, then the value is multiplied by 100 before 944 being displayed.</p> 945 <p>To insert a special character in a pattern as a literal, 946 that is, without any special meaning, the character must be 947 quoted. There are some exceptions to this which are noted 948 below. The Localized Replacement column shows the replacement 949 from <em>Section 2.3 <a href="#Number_Symbols">Number 950 Symbols</a></em> or the numberSystem's digits: <em>italic</em> 951 indicates a special function.</p> 952 <p>Invalid sequences of special characters (such as “¤¤¤¤¤” in 953 current CLDR) should be handled for formatting and parsing as 954 described in <a href="tr35.html#Invalid_Patterns">Handling 955 Invalid Patterns</a>.</p> 956 <blockquote> 957 <table cellspacing="3" cellpadding="0" summary= 958 "Chart showing symbol, location, localized, and meaning." 959 border="0"> 960 <caption> 961 <a name="Number_Pattern_Character_Definitions" href= 962 "#Number_Pattern_Character_Definitions" id= 963 "Number_Pattern_Character_Definitions">Number Pattern 964 Character Definitions</a> 965 </caption> 966 <tr bgcolor="#CCCCFF"> 967 <th align="left">Symbol</th> 968 <th align="left">Location</th> 969 <th align="left">Localized Replacement</th> 970 <th colspan="2" align="left">Meaning</th> 971 </tr> 972 <tr valign="top"> 973 <td>0</td> 974 <td>Number</td> 975 <td>digit</td> 976 <td colspan="2">Digit</td> 977 </tr> 978 <tr valign="top" bgcolor="#EEEEFF"> 979 <td>1-9</td> 980 <td>Number</td> 981 <td>digit</td> 982 <td colspan="2">'1' through '9' indicate rounding.</td> 983 </tr> 984 <tr valign="top"> 985 <td>@</td> 986 <td>Number</td> 987 <td>digit</td> 988 <td colspan="2">Significant digit</td> 989 </tr> 990 <tr valign="top" bgcolor="#EEEEFF"> 991 <td>#</td> 992 <td>Number</td> 993 <td>digit, <em>nothing</em></td> 994 <td colspan="2">Digit, omitting leading/trailing 995 zeros</td> 996 </tr> 997 <tr valign="top"> 998 <td>.</td> 999 <td>Number</td> 1000 <td>decimal, currencyDecimal</td> 1001 <td colspan="2">Decimal separator or monetary decimal 1002 separator</td> 1003 </tr> 1004 <tr valign="top" bgcolor="#EEEEFF"> 1005 <td>-</td> 1006 <td>Number</td> 1007 <td>minusSign, plusSign, approximatelySign</td> 1008 <td colspan="2">Minus sign. <strong>Warning:</strong> the 1009 pattern '-'0.0 is not the same as the pattern -0.0. In 1010 the former case, the minus sign is a literal. In the 1011 latter case, it is a special symbol, which is replaced by 1012 the minusSymbol, and can also be replaced by the 1013 plusSymbol for a format like +12% as in Section 3.2.1 1014 <a href="#Explicit_Plus">Explicit Plus Signs</a>.</td> 1015 </tr> 1016 <tr valign="top"> 1017 <td>,</td> 1018 <td>Number</td> 1019 <td>group, currencyGroup</td> 1020 <td colspan="2">Grouping separator. May occur in both the 1021 integer part and the fractional part. The position 1022 determines the grouping.</td> 1023 </tr> 1024 <tr valign="top" bgcolor="#EEEEFF"> 1025 <td>E</td> 1026 <td>Number</td> 1027 <td>exponential, superscriptingExponent</td> 1028 <td colspan="2">Separates mantissa and exponent in 1029 scientific notation. <em>Need not be quoted in prefix or 1030 suffix.</em></td> 1031 </tr> 1032 <tr valign="top"> 1033 <td>+</td> 1034 <td>Exponent or Number (for explicit plus)</td> 1035 <td>plusSign</td> 1036 <td colspan="2">Prefix positive exponents with localized 1037 plus sign. Used for explicit plus for numbers as well, as 1038 described in Section 3.2.1 <a href= 1039 "#Explicit_Plus">Explicit Plus Signs</a>. <em><br> 1040 Need not be quoted in prefix or suffix.</em></td> 1041 </tr> 1042 <tr valign="top"> 1043 <td>%</td> 1044 <td>Prefix or suffix</td> 1045 <td>percentSign</td> 1046 <td colspan="2">Multiply by 100 and show as 1047 percentage</td> 1048 </tr> 1049 <tr valign="top" bgcolor="#EEEEFF"> 1050 <td>‰<br> 1051 (U+2030)</td> 1052 <td>Prefix or suffix</td> 1053 <td>perMille</td> 1054 <td colspan="2">Multiply by 1000 and show as per mille 1055 (aka “basis points”)</td> 1056 </tr> 1057 <tr valign="top" bgcolor="#EEEEFF"> 1058 <td>;</td> 1059 <td>Subpattern boundary</td> 1060 <td><em>syntax</em></td> 1061 <td colspan="2">Separates positive and negative 1062 subpatterns. When there is no explicit negative 1063 subpattern, an implicit negative subpattern is formed 1064 from the positive pattern with a prefixed - (ASCII U+002D 1065 HYPHEN-MINUS).</td> 1066 </tr> 1067 <tr valign="top"> 1068 <td rowspan="11">¤ (U+00A4)</td> 1069 <td rowspan="11">Prefix or suffix</td> 1070 <td rowspan="11"><em>currency symbol/name from currency 1071 specified in API</em></td> 1072 <td colspan="2">Any sequence is replaced by the localized 1073 currency symbol for the currency being formatted, as in 1074 the table below. If present in a pattern, the monetary 1075 decimal separator and grouping separators (if available) 1076 are used instead of the numeric ones. If data is 1077 unavailable for a given sequence in a given locale, the 1078 display may fall back to ¤ or ¤¤. See also the formatting 1079 forcurrency display names, steps 2 and 4 in <a href= 1080 "#Currencies">Currencies</a>.</td> 1081 </tr> 1082 <tr valign="top"> 1083 <th>No.</th> 1084 <th>Replacement / Example</th> 1085 </tr> 1086 <tr valign="top"> 1087 <td rowspan="2">¤</td> 1088 <td>Standard currency symbol</td> 1089 </tr> 1090 <tr valign="top"> 1091 <td><em>C$12.00</em></td> 1092 </tr> 1093 <tr valign="top"> 1094 <td rowspan="2">¤¤</td> 1095 <td>ISO currency symbol (constant)</td> 1096 </tr> 1097 <tr valign="top"> 1098 <td><em>CAD 12.00</em></td> 1099 </tr> 1100 <tr valign="top"> 1101 <td rowspan="2">¤¤¤</td> 1102 <td>Appropriate currency display name for the currency, 1103 based on the plural rules in effect for the locale</td> 1104 </tr> 1105 <tr valign="top"> 1106 <td><em>5.00 Canadian dollars</em></td> 1107 </tr> 1108 <tr valign="top"> 1109 <td rowspan="2" nowrap>¤¤¤¤¤</td> 1110 <td>Narrow currency symbol. The same symbols may be used 1111 for multiple currencies. Thus the symbol may be 1112 ambiguous, and should only be used where the context is 1113 clear.</td> 1114 </tr> 1115 <tr valign="top"> 1116 <td><em>$12.00</em></td> 1117 </tr> 1118 <tr valign="top"> 1119 <td><em>others</em></td> 1120 <td><em>Invalid in current CLDR. Reserved for future 1121 specification</em></td> 1122 </tr> 1123 <tr valign="top"> 1124 <td>*</td> 1125 <td>Prefix or suffix boundary</td> 1126 <td><em>padding character specified in API</em></td> 1127 <td colspan="2">Pad escape, precedes pad character</td> 1128 </tr> 1129 <tr valign="top" bgcolor="#EEEEFF"> 1130 <td>'</td> 1131 <td>Prefix or suffix</td> 1132 <td><em>syntax-only</em></td> 1133 <td colspan="2">Used to quote special characters in a 1134 prefix or suffix, for example, <code>"'#'#"</code> 1135 formats 123 to <code>"#123"</code>. To create a single 1136 quote itself, use two in a row: <code>"# 1137 o''clock"</code>.</td> 1138 </tr> 1139 </table> 1140 </blockquote> 1141 <p>A pattern contains a positive subpattern and may contain a 1142 negative subpattern, for example, "#,##0.00;(#,##0.00)". Each 1143 subpattern has a prefix, a numeric part, and a suffix. If there 1144 is no explicit negative subpattern, the implicit negative 1145 subpattern is the ASCII minus sign (-) prefixed to the positive 1146 subpattern. That is, "0.00" alone is equivalent to 1147 "0.00;-0.00". (The data in CLDR is normalized to remove an 1148 explicit negative subpattern where it would be identical to the 1149 implicit form.)</p> 1150 <p>Note that if an negative subpattern is used as-is: a minus 1151 sign is <em>not</em> added, eg "0.00;0.00" ≠ "0.00;-0.00". 1152 Trailing semicolons are ignored, eg "0.00;" = "0.00". 1153 Whitespace is not ignored, including those around semicolons, 1154 so "0.00; -0.00" ≠ "0.00; -0.00".</p> 1155 <p>If there is an explicit negative subpattern, it serves only 1156 to specify the negative prefix and suffix; the number of 1157 digits, minimal digits, and other characteristics are ignored 1158 in the negative subpattern. That means that "#,##0.0#;(#)" has 1159 precisely the same result as "#,##0.0#;(#,##0.0#)". However in 1160 the CLDR data, the format is normalized so that the other 1161 characteristics are preserved, just for readability.</p> 1162 <blockquote> 1163 <p><b>Note:</b> The thousands separator and decimal separator 1164 in patterns are always ASCII ',' and '.'. They are 1165 substituted by the code with the correct local values 1166 according to other fields in CLDR. The same is true of the - 1167 (ASCII minus sign) and other special characters listed 1168 above.</p> 1169 </blockquote> 1170 <p>Below is a sample of patterns, special characters, and 1171 results:</p> 1172 <div align="center"> 1173 <table border="0" cellpadding="0" cellspacing="3"> 1174 <caption> 1175 <a name='Sample_Patterns_and_Results' href= 1176 '#Sample_Patterns_and_Results' id= 1177 "Sample_Patterns_and_Results">Sample Patterns and 1178 Results</a> 1179 </caption> 1180 <tr valign="top"> 1181 <th> 1182 <div align="right"> 1183 explicit pattern: 1184 </div> 1185 </th> 1186 <td colspan="2"> 1187 <div align="center"> 1188 0.00;-0.00 1189 </div> 1190 </td> 1191 <td colspan="2"> 1192 <div align="center"> 1193 0.00;0.00- 1194 </div> 1195 </td> 1196 <td colspan="2"> 1197 <div align="center"> 1198 0.00+;0.00- 1199 </div> 1200 </td> 1201 </tr> 1202 <tr valign="top"> 1203 <th> 1204 <div align="right"> 1205 decimalSign: 1206 </div> 1207 </th> 1208 <td colspan="2"> 1209 <div align="center"> 1210 , 1211 </div> 1212 </td> 1213 <td colspan="2"> 1214 <div align="center"> 1215 , 1216 </div> 1217 </td> 1218 <td colspan="2"> 1219 <div align="center"> 1220 , 1221 </div> 1222 </td> 1223 </tr> 1224 <tr valign="top"> 1225 <th> 1226 <div align="right"> 1227 minusSign: 1228 </div> 1229 </th> 1230 <td colspan="2"> 1231 <div align="center"> 1232 ∸ 1233 </div> 1234 </td> 1235 <td colspan="2"> 1236 <div align="center"> 1237 ∸ 1238 </div> 1239 </td> 1240 <td colspan="2"> 1241 <div align="center"> 1242 ∸ 1243 </div> 1244 </td> 1245 </tr> 1246 <tr valign="top"> 1247 <th> 1248 <div align="right"> 1249 plusSign: 1250 </div> 1251 </th> 1252 <td colspan="2"> 1253 <div align="center"> 1254 ∔ 1255 </div> 1256 </td> 1257 <td colspan="2"> 1258 <div align="center"> 1259 ∔ 1260 </div> 1261 </td> 1262 <td colspan="2"> 1263 <div align="center"> 1264 ∔ 1265 </div> 1266 </td> 1267 </tr> 1268 <tr valign="top"> 1269 <th> 1270 <div align="right"> 1271 number: 1272 </div> 1273 </th> 1274 <td> 1275 <div align="center"> 1276 3.1415 1277 </div> 1278 </td> 1279 <td> 1280 <div align="center"> 1281 -3.1415 1282 </div> 1283 </td> 1284 <td> 1285 <div align="center"> 1286 3.1415 1287 </div> 1288 </td> 1289 <td> 1290 <div align="center"> 1291 -3.1415 1292 </div> 1293 </td> 1294 <td> 1295 <div align="center"> 1296 3.1415 1297 </div> 1298 </td> 1299 <td> 1300 <div align="center"> 1301 -3.1415 1302 </div> 1303 </td> 1304 </tr> 1305 <tr valign="top"> 1306 <th> 1307 <div align="right"> 1308 formatted: 1309 </div> 1310 </th> 1311 <td> 1312 <div align="center"> 1313 3,14 1314 </div> 1315 </td> 1316 <td> 1317 <div align="center"> 1318 ∸3,14 1319 </div> 1320 </td> 1321 <td> 1322 <div align="center"> 1323 3,14 1324 </div> 1325 </td> 1326 <td> 1327 <div align="center"> 1328 3,14∸ 1329 </div> 1330 </td> 1331 <td> 1332 <div align="center"> 1333 3,14∔ 1334 </div> 1335 </td> 1336 <td> 1337 <div align="center"> 1338 3,14∸ 1339 </div> 1340 </td> 1341 </tr> 1342 </table> 1343 <p><em>In the above table, ∸ = U+2238 DOT MINUS and ∔ = 1344 U+2214 DOT PLUS are used for illustration.</em></p> 1345 </div> 1346 <p>The prefixes, suffixes, and various symbols used for 1347 infinity, digits, thousands separators, decimal separators, and 1348 so on may be set to arbitrary values, and they will appear 1349 properly during formatting. <i>However, care must be taken that 1350 the symbols and strings do not conflict, or parsing will be 1351 unreliable.</i> For example, either the positive and negative 1352 prefixes or the suffixes must be distinct for any parser using 1353 this data to be able to distinguish positive from negative 1354 values. Another example is that the decimal separator and 1355 thousands separator should be distinct characters, or parsing 1356 will be impossible.</p> 1357 <p>The <em>grouping separator</em> is a character that 1358 separates clusters of integer digits to make large numbers more 1359 legible. It is commonly used for thousands, but in some locales 1360 it separates ten-thousands. The <em>grouping size</em> is the 1361 number of digits between the grouping separators, such as 3 for 1362 "100,000,000" or 4 for "1 0000 0000". There are actually two 1363 different grouping sizes: One used for the least significant 1364 integer digits, the <em>primary grouping size</em>, and one 1365 used for all others, the <em>secondary grouping size</em>. In 1366 most locales these are the same, but sometimes they are 1367 different. For example, if the primary grouping interval is 3, 1368 and the secondary is 2, then this corresponds to the pattern 1369 "#,##,##0", and the number 123456789 is formatted as 1370 "12,34,56,789". If a pattern contains multiple grouping 1371 separators, the interval between the last one and the end of 1372 the integer defines the primary grouping size, and the interval 1373 between the last two defines the secondary grouping size. All 1374 others are ignored, so "#,##,###,####" == "###,###,####" == 1375 "##,#,###,####".</p> 1376 <p>The grouping separator may also occur in the fractional 1377 part, such as in “#,##0.###,#”. This is most commonly done 1378 where the grouping separator character is a thin, non-breaking 1379 space (U+202F), such as “1.618 033 988 75”. See <a href= 1380 "https://physics.nist.gov/cuu/Units/checklist.html">physics.nist.gov/cuu/Units/checklist.html</a>.</p> 1381 <p>For consistency in the CLDR data, the following conventions 1382 are observed:</p> 1383 <ul> 1384 <li>All number patterns should be minimal: there should be no 1385 leading # marks except to specify the position of the 1386 grouping separators (for example, avoid 1387 ##,##0.###).</li> 1388 <li>All formats should have one 0 before the decimal point 1389 (for example, avoid #,###.##)</li> 1390 <li>Decimal formats should have three hash marks in the 1391 fractional position (for example, #,##0.###).</li> 1392 <li>Currency formats should have two zeros in the fractional 1393 position (for example, ¤ #,##0.00). 1394 <ul> 1395 <li>The exact number of decimals is overridden with the 1396 decimal count in supplementary data or by API 1397 settings.</li> 1398 </ul> 1399 </li> 1400 <li>The only time two thousands separators needs to be used 1401 is when the number of digits varies, such as for Hindi: 1402 #,##,##0.</li> 1403 <li>The <strong>minimumGroupingDigits</strong> can be used to 1404 suppress groupings below a certain value. This is used for 1405 languages such as Polish, where one would only write the 1406 grouping separator for values above 9999. The 1407 minimumGroupingDigits contains the default for the locale. 1408 <ul> 1409 <li>The attribute value is used by adding it to the 1410 grouping separator value. If the input number has fewer 1411 integer digits, the grouping separator is 1412 suppressed.</li> 1413 <li> 1414 <table border="1" cellpadding="0" cellspacing="0"> 1415 <caption> 1416 <a name="Examples_of_minimumGroupingDigits" href= 1417 "#Examples_of_minimumGroupingDigits" id= 1418 "Examples_of_minimumGroupingDigits">Examples of 1419 minimumGroupingDigits</a> 1420 </caption> 1421 <tr> 1422 <th width="25%" scope="col"> 1423 <div align="center"> 1424 minimumGroupingDigits 1425 </div> 1426 </th> 1427 <th width="25%" scope="col"> 1428 <div align="center"> 1429 Pattern Grouping 1430 </div> 1431 </th> 1432 <th width="25%" scope="col"> 1433 <div align="center"> 1434 Input Number 1435 </div> 1436 </th> 1437 <th width="25%" scope="col"> 1438 <div align="center"> 1439 Formatted 1440 </div> 1441 </th> 1442 </tr> 1443 <tr> 1444 <td> 1445 <div align="right"> 1446 1 1447 </div> 1448 </td> 1449 <td> 1450 <div align="right"> 1451 3 1452 </div> 1453 </td> 1454 <td> 1455 <div align="right"> 1456 1000 1457 </div> 1458 </td> 1459 <td> 1460 <div align="right"> 1461 1,000 1462 </div> 1463 </td> 1464 </tr> 1465 <tr> 1466 <td> 1467 <div align="right"> 1468 1 1469 </div> 1470 </td> 1471 <td> 1472 <div align="right"> 1473 3 1474 </div> 1475 </td> 1476 <td> 1477 <div align="right"> 1478 10000 1479 </div> 1480 </td> 1481 <td> 1482 <div align="right"> 1483 10,000 1484 </div> 1485 </td> 1486 </tr> 1487 <tr> 1488 <td> 1489 <div align="right"> 1490 2 1491 </div> 1492 </td> 1493 <td> 1494 <div align="right"> 1495 3 1496 </div> 1497 </td> 1498 <td> 1499 <div align="right"> 1500 1000 1501 </div> 1502 </td> 1503 <td> 1504 <div align="right"> 1505 1000 1506 </div> 1507 </td> 1508 </tr> 1509 <tr> 1510 <td> 1511 <div align="right"> 1512 2 1513 </div> 1514 </td> 1515 <td> 1516 <div align="right"> 1517 3 1518 </div> 1519 </td> 1520 <td> 1521 <div align="right"> 1522 10000 1523 </div> 1524 </td> 1525 <td> 1526 <div align="right"> 1527 10,000 1528 </div> 1529 </td> 1530 </tr> 1531 <tr> 1532 <td> 1533 <div align="right"> 1534 1 1535 </div> 1536 </td> 1537 <td> 1538 <div align="right"> 1539 4 1540 </div> 1541 </td> 1542 <td> 1543 <div align="right"> 1544 10000 1545 </div> 1546 </td> 1547 <td> 1548 <div align="right"> 1549 1,0000 1550 </div> 1551 </td> 1552 </tr> 1553 <tr> 1554 <td> 1555 <div align="right"> 1556 2 1557 </div> 1558 </td> 1559 <td> 1560 <div align="right"> 1561 4 1562 </div> 1563 </td> 1564 <td> 1565 <div align="right"> 1566 10000 1567 </div> 1568 </td> 1569 <td> 1570 <div align="right"> 1571 10000 1572 </div> 1573 </td> 1574 </tr> 1575 </table> 1576 </li> 1577 </ul> 1578 </li> 1579 </ul> 1580 <h4>3.2.1 <a name="Explicit_Plus" href="#Explicit_Plus" id= 1581 "Explicit_Plus">Explicit Plus Signs</a></h4> 1582 <p>An explicit "plus" format can be formed, so as to show a 1583 visible + sign when formatting a non-negative number. The 1584 displayed plus sign can be an ASCII plus or another character, 1585 such as + U+FF0B FULLWIDTH PLUS SIGN or ➕ U+2795 HEAVY PLUS 1586 SIGN; it is taken from whatever is set for plusSign in 1587 <em>Section 2.3 <a href="#Number_Symbols">Number 1588 Symbols</a></em>.</p> 1589 <ol> 1590 <li>Get the negative subpattern (explicit or implicit).</li> 1591 <li>Replace any unquoted ASCII minus sign by an ASCII plus 1592 sign.</li> 1593 <li>If there are any replacements, use that for the positive 1594 subpattern.</li> 1595 </ol> 1596 <p>For an example, see <a href= 1597 "#Sample_Patterns_and_Results">Sample Patterns and 1598 Results</a>.</p> 1599 <h3>3.3 <a name="Formatting" href="#Formatting" id= 1600 "Formatting">Formatting</a></h3> 1601 <p>Formatting is guided by several parameters, all of which can 1602 be specified either using a pattern or using an external API 1603 designed for number formatting. The following description 1604 applies to formats that do not use <a href="#sci">scientific 1605 notation</a> or <a href="#sigdig">significant digits</a>.</p> 1606 <ul> 1607 <li>If the number of actual integer digits exceeds the 1608 <em>maximum integer digits</em>, then only the least 1609 significant digits are shown. For example, 1997 is formatted 1610 as "97" if the maximum integer digits is set to 2.</li> 1611 <li>If the number of actual integer digits is less than the 1612 <em>minimum integer digits</em>, then leading zeros are 1613 added. For example, 1997 is formatted as "01997" if the 1614 minimum integer digits is set to 5.</li> 1615 <li>If the number of actual fraction digits exceeds the 1616 <em>maximum fraction digits</em>, then half-even rounding it 1617 performed to the maximum fraction digits. For example, 0.125 1618 is formatted as "0.12" if the maximum fraction digits is 2. 1619 This behavior can be changed by specifying a rounding 1620 increment and a rounding mode.</li> 1621 <li>If the number of actual fraction digits is less than the 1622 <em>minimum fraction digits</em>, then trailing zeros are 1623 added. For example, 0.125 is formatted as "0.1250" if the 1624 minimum fraction digits is set to 4.</li> 1625 <li>Trailing fractional zeros are not displayed if they occur 1626 <em>j</em> positions after the decimal, where <em>j</em> is 1627 less than the maximum fraction digits. For example, 0.10004 1628 is formatted as "0.1" if the maximum fraction digits is four 1629 or less.</li> 1630 </ul> 1631 <p><strong>Special Values</strong></p> 1632 <p><code>NaN</code> is represented as a single character, 1633 typically <code>(U+FFFD)</code> . This character is determined 1634 by the localized number symbols. This is the only value for 1635 which the prefixes and suffixes are not used.</p> 1636 <p>Infinity is represented as a single character, typically 1637 <font size="3">∞</font> <code>(U+221E)</code> , with the 1638 positive or negative prefixes and suffixes applied. The 1639 infinity character is determined by the localized number 1640 symbols.</p> 1641 <h3>3.4 <a name="sci" href="#sci" id="sci">Scientific 1642 Notation</a></h3> 1643 <p>Numbers in scientific notation are expressed as the product 1644 of a mantissa and a power of ten, for example, 1234 can be 1645 expressed as 1.234 x 10<sup>3</sup>. The mantissa is typically 1646 in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0), 1647 but it need not be. In a pattern, the exponent character 1648 immediately followed by one or more digit characters indicates 1649 scientific notation. Example: "0.###E0" formats the number 1234 1650 as "1.234E3".</p> 1651 <ul> 1652 <li>The number of digit characters after the exponent 1653 character gives the minimum exponent digit count. There is no 1654 maximum. Negative exponents are formatted using the localized 1655 minus sign, <em>not</em> the prefix and suffix from the 1656 pattern. This allows patterns such as "0.###E0 m/s". To 1657 prefix positive exponents with a localized plus sign, specify 1658 '+' between the exponent and the digits: "0.###E+0" will 1659 produce formats "1E+1", "1E+0", "1E-1", and so on. (In 1660 localized patterns, use the localized plus sign rather than 1661 '+'.)</li> 1662 <li>The minimum number of integer digits is achieved by 1663 adjusting the exponent. Example: 0.00123 formatted with 1664 "00.###E0" yields "12.3E-4". This only happens if there is no 1665 maximum number of integer digits. If there is a maximum, then 1666 the minimum number of integer digits is fixed at one.</li> 1667 <li>The maximum number of integer digits, if present, 1668 specifies the exponent grouping. The most common use of this 1669 is to generate <em>engineering notation</em>, in which the 1670 exponent is a multiple of three, for example, "##0.###E0". 1671 The number 12345 is formatted using "##0.####E0" as 1672 "12.345E3".</li> 1673 <li> 1674 <p>When using scientific notation, the formatter controls 1675 the digit counts using logic for significant digits. The 1676 maximum number of significant digits comes from the 1677 mantissa portion of the pattern: the string 1678 of #, 0, and period (".") characters 1679 immediately preceding the E. To get the maximum number 1680 of significant digits, use the following algorithm:<br></p> 1681 <ol> 1682 <li>If the mantissa pattern contains a period: 1683 <ol> 1684 <li>If the mantissa pattern contains at least 1685 one 0: 1686 <ul> 1687 <li>Return the number of 0s before 1688 the period added to the number 1689 of #s or 0s after the period</li> 1690 </ul> 1691 </li> 1692 <li>Else: 1693 <ul> 1694 <li>Return 1 plus the number of #s after 1695 the period</li> 1696 </ul> 1697 </li> 1698 </ol> 1699 </li> 1700 <li>Else: 1701 <ol> 1702 <li>If the mantissa pattern contains at least 1703 one 0: 1704 <ul> 1705 <li>Return the number of 0s.</li> 1706 </ul> 1707 </li> 1708 <li>Else: 1709 <ul> 1710 <li>Return positive infinity.</li> 1711 </ul> 1712 </li> 1713 </ol> 1714 </li> 1715 </ol> 1716 <p>Examples:<br></p> 1717 <ul> 1718 <li>0.##E0 means a max of 3 significant digits.</li> 1719 <li>#.##E0 also means a max of 3 significant 1720 digits.</li> 1721 <li>#.0#E0 means a max of 2 significant digits.</li> 1722 <li>0E0 means a max of 1 significant digit.</li> 1723 <li>#E0 means infinite precision.</li> 1724 <li>###E0 means engineering notation with infinite 1725 precision.</li> 1726 </ul> 1727 </li> 1728 <li>Exponential patterns may not contain grouping 1729 separators.</li> 1730 </ul> 1731 <h3>3.5 <a name="sigdig" href="#sigdig" id="sigdig">Significant 1732 Digits</a></h3> 1733 <p>There are two ways of controlling how many digits are shows: 1734 (a) significant digits counts, or (b) integer and fraction 1735 digit counts. Integer and fraction digit counts are described 1736 above. When a formatter is using significant digits counts, it 1737 uses however many integer and fraction digits are required to 1738 display the specified number of significant digits. It may 1739 ignore min/max integer/fraction digits, or it may use them to 1740 the extent possible.</p> 1741 <blockquote> 1742 <table cellpadding="0" border="0"> 1743 <caption> 1744 <a name="Significant_Digits_Examples" href= 1745 "#Significant_Digits_Examples" id= 1746 "Significant_Digits_Examples">Significant Digits 1747 Examples</a> 1748 </caption> 1749 <tr bgcolor="#CCCCFF"> 1750 <th align="left">Pattern</th> 1751 <th align="left">Minimum significant digits</th> 1752 <th align="left">Maximum significant digits</th> 1753 <th align="left">Number</th> 1754 <th align="left">Output</th> 1755 </tr> 1756 <tr valign="top"> 1757 <td><code>@@@</code></td> 1758 <td>3</td> 1759 <td>3</td> 1760 <td>12345</td> 1761 <td><code>12300</code></td> 1762 </tr> 1763 <tr valign="top" bgcolor="#EEEEFF"> 1764 <td><code>@@@</code></td> 1765 <td>3</td> 1766 <td>3</td> 1767 <td>0.12345</td> 1768 <td><code>0.123</code></td> 1769 </tr> 1770 <tr valign="top"> 1771 <td><code>@@##</code></td> 1772 <td>2</td> 1773 <td>4</td> 1774 <td>3.14159</td> 1775 <td><code>3.142</code></td> 1776 </tr> 1777 <tr valign="top" bgcolor="#EEEEFF"> 1778 <td><code>@@##</code></td> 1779 <td>2</td> 1780 <td>4</td> 1781 <td>1.23004</td> 1782 <td><code>1.23</code></td> 1783 </tr> 1784 </table> 1785 </blockquote> 1786 <ul> 1787 <li>In order to enable significant digits formatting, use a 1788 pattern containing the <code>'@'</code> pattern character. In 1789 order to disable significant digits formatting, use a pattern 1790 that does not contain the <code>'@'</code> pattern 1791 character.</li> 1792 <li>Significant digit counts may be expressed using patterns 1793 that specify a minimum and maximum number of significant 1794 digits. These are indicated by the <code>'@'</code> and 1795 <code>'#'</code> characters. The minimum number of 1796 significant digits is the number of <code>'@'</code> 1797 characters. The maximum number of significant digits is the 1798 number of <code>'@'</code> characters plus the number of 1799 <code>'#'</code> characters following on the right. For 1800 example, the pattern <code>"@@@"</code> indicates exactly 3 1801 significant digits. The pattern <code>"@##"</code> indicates 1802 from 1 to 3 significant digits. Trailing zero digits to the 1803 right of the decimal separator are suppressed after the 1804 minimum number of significant digits have been shown. For 1805 example, the pattern <code>"@##"</code> formats the number 1806 0.1203 as <code>"0.12"</code>.</li> 1807 <li>Implementations may forbid the use of significant digits 1808 in combination with min/max integer/fraction digits. In such 1809 a case, if a pattern uses significant digits, it may not 1810 contain a decimal separator, nor the <code>'0'</code> pattern 1811 character. Patterns such as <code>"@00"</code> or 1812 <code>"@.###"</code> would be disallowed.</li> 1813 <li>Any number of <code>'#'</code> characters may be 1814 prepended to the left of the leftmost <code>'@'</code> 1815 character. These have no effect on the minimum and maximum 1816 significant digits counts, but may be used to position 1817 grouping separators. For example, <code>"#,#@#"</code> 1818 indicates a minimum of one significant digits, a maximum of 1819 two significant digits, and a grouping size of three.</li> 1820 <li>The number of significant digits has no effect on 1821 parsing.</li> 1822 <li>Significant digits may be used together with exponential 1823 notation. Such patterns are equivalent to a normal 1824 exponential pattern with a minimum and maximum integer digit 1825 count of one, a minimum fraction digit count of <code>Minimum 1826 Significant Digits - 1</code>, and a maximum fraction digit 1827 count of <code>Maximum Significant Digits - 1</code>. For 1828 example, the pattern <code>"@@###E0"</code> is equivalent to 1829 <code>"0.0###E0"</code>.</li> 1830 </ul> 1831 <h3>3.6 <a name="Padding" href="#Padding" id= 1832 "Padding">Padding</a></h3> 1833 <p>Patterns support padding the result to a specific width. In 1834 a pattern the pad escape character, followed by a single pad 1835 character, causes padding to be parsed and formatted. The pad 1836 escape character is '*'. For example, 1837 <code>"$*x#,##0.00"</code> formats 123 to 1838 <code>"$xx123.00"</code> , and 1234 to <code>"$1,234.00"</code> 1839 .</p> 1840 <ul> 1841 <li>When padding is in effect, the width of the positive 1842 subpattern, including prefix and suffix, determines the 1843 format width. For example, in the pattern <code>"* #0 1844 o''clock"</code>, the format width is 10.</li> 1845 <li>Some parameters which usually do not matter have meaning 1846 when padding is used, because the pattern width is 1847 significant with padding. In the pattern "* ##,##,#,##0.##", 1848 the format width is 14. The initial characters "##,##," do 1849 not affect the grouping size or maximum integer digits, but 1850 they do affect the format width.</li> 1851 <li>Padding may be inserted at one of four locations: before 1852 the prefix, after the prefix, before the suffix, or after the 1853 suffix. No padding can be specified in any other location. If 1854 there is no prefix, before the prefix and after the prefix 1855 are equivalent, likewise for the suffix.</li> 1856 <li>When specified in a pattern, the code point immediately 1857 following the pad escape is the pad character. This may be 1858 any character, including a special pattern character. That 1859 is, the pad escape <em>escapes</em> the following character. 1860 If there is no character after the pad escape, then the 1861 pattern is illegal.</li> 1862 </ul> 1863 <h3>3.7 <a name="Rounding" href="#Rounding" id= 1864 "Rounding">Rounding</a></h3> 1865 <p>Patterns support rounding to a specific increment. For 1866 example, 1230 rounded to the nearest 50 is 1250. 1867 Mathematically, rounding to specific increments is performed by 1868 dividing by the increment, rounding to an integer, then 1869 multiplying by the increment. To take a more bizarre example, 1870 1.234 rounded to the nearest 0.65 is 1.3, as follows:</p> 1871 <table border="1" cellpadding="0" cellspacing="0" style= 1872 "border-collapse: collapse"> 1873 <!-- nocaption --> 1874 <tr> 1875 <th>Original:</th> 1876 <td>1.234</td> 1877 </tr> 1878 <tr> 1879 <th>Divide by increment (0.65):</th> 1880 <td>1.89846…</td> 1881 </tr> 1882 <tr> 1883 <th>Round:</th> 1884 <td>2</td> 1885 </tr> 1886 <tr> 1887 <th>Multiply by increment (0.65):</th> 1888 <td>1.3</td> 1889 </tr> 1890 </table> 1891 <p>To specify a rounding increment in a pattern, include the 1892 increment in the pattern itself. "#,#50" specifies a rounding 1893 increment of 50. "#,##0.05" specifies a rounding increment of 1894 0.05.</p> 1895 <ul> 1896 <li>Rounding only affects the string produced by formatting. 1897 It does not affect parsing or change any numerical 1898 values.</li> 1899 <li>An implementation may allow the specification of a 1900 <em>rounding mode</em> to determine how values are rounded. 1901 In the absence of such choices, the default is to round 1902 "half-even", as described in IEEE arithmetic. That is, it 1903 rounds towards the "nearest neighbor" unless both neighbors 1904 are equidistant, in which case, it rounds towards the even 1905 neighbor. Behaves as for round "half-up" if the digit to the 1906 left of the discarded fraction is odd; behaves as for round 1907 "half-down" if it's even. Note that this is the rounding mode 1908 that minimizes cumulative error when applied repeatedly over 1909 a sequence of calculations.</li> 1910 <li>Some locales use rounding in their currency formats to 1911 reflect the smallest currency denomination.</li> 1912 <li>In a pattern, digits '1' through '9' specify rounding, 1913 but otherwise behave identically to digit '0'.</li> 1914 </ul> 1915 <h3>3.8 <a name="Quoting_Rules" href="#Quoting_Rules" id= 1916 "Quoting_Rules">Quoting Rules</a></h3> 1917 <blockquote> 1918 <p>Single quotes, (<b>'</b>), enclose bits of the pattern 1919 that should be treated literally. Inside a quoted string, two 1920 single quotes ('') are replaced with a single one ('). For 1921 example: <tt><u>'X '</u>#<u>' Q '</u></tt> -> <b>X 1939 1922 Q</b> (Literal strings <u>underlined</u>.)</p> 1923 </blockquote> 1924 <h2><a name="Currencies" href="#Currencies" id="Currencies">4 1925 Currencies</a></h2> 1926 <p class="dtd"><!ELEMENT currencies (alias | (default?, 1927 currency*, special*)) ><br> 1928 <!ELEMENT currency (alias | (((pattern+, displayName*, 1929 symbol*) | (displayName+, symbol*, pattern*) | (symbol+, 1930 pattern*))?, decimal*, group*, special*)) ><br> 1931 <!ELEMENT symbol ( #PCDATA ) ><br> 1932 <!ATTLIST symbol choice ( true | false ) #IMPLIED > 1933 <!-- deprecated --></p> 1934 <blockquote> 1935 <p><b>Note:</b> The term "pattern" appears twice in the 1936 above. The first is for consistency with all other cases of 1937 pattern + displayName; the second is for backwards 1938 compatibility.</p> 1939 </blockquote> 1940 <pre><currencies> 1941 <currency type="<span style="color: blue">USD</span>"> 1942 <displayName><span style= 1943"color: blue">Dollar</span></displayName> 1944 <symbol><span style= 1945"color: blue">$</span></symbol> 1946 </currency> 1947 <currency type ="<span style="color: blue">JPY</span>"> 1948 <displayName><span style= 1949"color: blue">Yen</span></displayName> 1950 <symbol><span style= 1951"color: blue">¥</span></symbol> 1952 </currency> 1953 <currency type="PTE"> 1954 <displayName><span style= 1955"color: blue">Escudo</span></displayName> 1956 <symbol><span style= 1957"color: blue">$</span></symbol> 1958 </currency> 1959</currencies></pre> 1960 <p>In formatting currencies, the currency number format is used 1961 with the appropriate symbol from <currencies>, according 1962 to the currency code. The <currencies> list can contain 1963 codes that are no longer in current use, such as PTE. The 1964 choice attribute has been deprecated.</p> 1965 <p>The count attribute distinguishes the different plural 1966 forms, such as in the following:</p> 1967 <pre><currencyFormats> 1968 <unitPattern count="other">{0} {1}</unitPattern> 1969 … 1970<currencies></pre> 1971 <pre><currency type="ZWD"> 1972 <displayName>Zimbabwe Dollar</displayName> 1973 <displayName count="one">Zimbabwe dollar</displayName> 1974 <displayName count="other">Zimbabwe dollars</displayName> 1975 <symbol>Z$</symbol> 1976</currency></pre> 1977 <p>To format a particular currency value "ZWD" for a particular 1978 numeric value <em>n</em> using the (long) display name:</p> 1979 <ol> 1980 <li>If the numeric value is exactly 0 or 1, first see if 1981 there is a count with a matching explicit number (0 or 1). If 1982 so, use that string (see <a href= 1983 "#Explicit_0_1_rules">Explicit 0 and 1 rules</a>).</li> 1984 <li>Otherwise, determine the count value that corresponds to 1985 <em>n</em> using the rules in <i><a href= 1986 "#Language_Plural_Rules">Section 5 - Language Plural 1987 Rules</a></i></li> 1988 <li style="margin-top: 0.5em; margin-bottom: 0.5em">Next, get 1989 the currency unitPattern. 1990 <ol> 1991 <li>Look for a unitPattern element that matches the count 1992 value, starting in the current locale and then following 1993 the locale fallback chain up to, but not including 1994 root.</li> 1995 <li>If no matching unitPattern element was found in the 1996 previous step, then look for a unitPattern element that 1997 matches count="other", starting in the current locale and 1998 then following the locale fallback chain up to root 1999 (which has a unitPattern element with count="other" for 2000 every unit type).</li> 2001 <li>The resulting unitPattern element indicates the 2002 appropriate positioning of the numeric value and the 2003 currency display name.</li> 2004 </ol> 2005 </li> 2006 <li style="margin-top: 0.5em; margin-bottom: 0.5em">Next, get 2007 the displayName element for the currency. 2008 <ol> 2009 <li>Look for a displayName element that matches the count 2010 value, starting in the current locale and then following 2011 the locale fallback chain up to, but not including 2012 root.</li> 2013 <li>If no matching displayName element was found in the 2014 previous step, then look for a displayName element that 2015 matches count="other", starting in the current locale and 2016 then following the locale fallback chain up to, but not 2017 including root.</li> 2018 <li>If no matching displayName element was found in the 2019 previous step, then look for a displayName element that 2020 with no count, starting in the current locale and then 2021 following the locale fallback chain up to root.</li> 2022 <li>If there is no displayName element, use the currency 2023 code itself (for example, "ZWD").</li> 2024 </ol> 2025 </li> 2026 <li>Format the numeric value according to the locale. Use the 2027 locale’s <decimalFormats …> pattern, not the 2028 <currencyFormats> pattern that is used with the symbol 2029 (eg, Z$). As when formatting symbol currency values, reset 2030 the number of decimals according to the supplemental 2031 <currencyData> and use the currencyDecimal symbol if 2032 different from the decimal symbol. 2033 <ol> 2034 <li>The number of decimals should be overridable in an 2035 API, so that clients can choose between “2 US dollars” 2036 and “2.00 US dollars”.</li> 2037 </ol> 2038 </li> 2039 <li>Substitute the formatted numeric value for the {0} in the 2040 unitPattern, and the currency display name for the {1}.</li> 2041 </ol> 2042 <p>While for English this may seem overly complex, for some 2043 other languages different plural forms are used for different 2044 unit types; the plural forms for certain unit types may not use 2045 all of the plural-form tags defined for the language.</p> 2046 <p>For example, if the the currency is ZWD and the number is 2047 1234, then the latter maps to count="other" for English. The 2048 unit pattern for that is "{0} {1}", and the display name is 2049 "Zimbabwe dollars". The final formatted number is then "1,234 2050 Zimbabwe dollars".</p> 2051 <p>When the currency symbol is substituted into a pattern, 2052 there may be some further modifications, according to the 2053 following.</p> 2054 <pre><currencySpacing> 2055 <beforeCurrency> 2056 <currencyMatch>[:^S:]</currencyMatch> 2057 <surroundingMatch>[:digit:]</surroundingMatch> 2058 <insertBetween> </insertBetween> 2059 </beforeCurrency> 2060 <afterCurrency> 2061 <currencyMatch>[:^S:]</currencyMatch> 2062 <surroundingMatch>[:digit:]</surroundingMatch> 2063 <insertBetween> </insertBetween> 2064 </afterCurrency> 2065</currencySpacing> 2066</pre> 2067 <p>This element controls whether additional characters are 2068 inserted on the boundary between the symbol and the pattern. 2069 For example, with the above <i>currencySpacing</i>, inserting 2070 the symbol "US$" into the pattern "#,##0.00¤" would result in 2071 an extra <i>no-break space</i> inserted before the symbol, for 2072 example, "#,##0.00 US$". The <i>beforeCurrency</i> element 2073 governs this case, since we are looking <i>before</i> the "¤" 2074 symbol. The <i>currencyMatch</i> is positive, since the "U" in 2075 "US$" is at the start of the currency symbol being substituted. 2076 The <i>surroundingMatch</i> is positive, since the character 2077 just before the "¤" will be a digit. Because these two 2078 conditions are true, the insertion is made.</p> 2079 <p>Conversely, look at the pattern "¤#,##0.00" with the symbol 2080 "US$". In this case, there is no insertion; the result is 2081 simply "US$#,##0.00". The <i>afterCurrency</i> element governs 2082 this case, since we are looking <i>after</i> the "¤" symbol. 2083 The surroundingMatch is positive, since the character just 2084 after the "¤" will be a digit. However, the currencyMatch is 2085 <b>not</b> positive, since the "$" in "US$" is at the end of 2086 the currency symbol being substituted. So the insertion is not 2087 made.</p> 2088 <p>For more information on the matching used in the 2089 currencyMatch and surroundingMatch elements, see the main 2090 document <i><a href="tr35.html#Unicode_Sets">Appendix E: 2091 Unicode Sets</a></i>.</p> 2092 <p>Currencies can also contain optional grouping, decimal data, 2093 and pattern elements. This data is inherited from the 2094 <symbols> in the same locale data (if not present in the 2095 chain up to root), so only the <i>differing</i> data will be 2096 present. See the main document <i>Section 4.1 <a href= 2097 "tr35.html#Multiple_Inheritance">Multiple 2098 Inheritance</a></i>.</p> 2099 <blockquote> 2100 <p class="note"><b>Note:</b> <i>Currency values should 2101 <b>never</b> be interchanged without a known currency code. 2102 You never want the number 3.5 interpreted as $3.50 by one 2103 user and €3.50 by another.</i> Locale data contains 2104 localization information for currencies, not a currency value 2105 for a country. A currency amount logically consists of a 2106 numeric value, plus an accompanying currency code (or 2107 equivalent). The currency code may be implicit in a protocol, 2108 such as where USD is implicit. But if the raw numeric value 2109 is transmitted without any context, then it has no definitive 2110 interpretation.</p> 2111 </blockquote> 2112 <p class="note">Notice that the currency code is completely 2113 independent of the end-user's language or locale. For example, 2114 BGN is the code for Bulgarian Lev. A currency amount of 2115 <BGN, 1.23456×10³> would be localized for a Bulgarian 2116 user into "1 234,56 лв." (using Cyrillic letters). For an 2117 English user it would be localized into the string "BGN 2118 1,234.56" The end-user's language is needed for doing this last 2119 localization step; but that language is completely orthogonal 2120 to the currency code needed in the data. After all, the same 2121 English user could be working with dozens of currencies. Notice 2122 also that the currency code is also independent of whether 2123 currency values are inter-converted, which requires more 2124 interesting financial processing: the rate of conversion may 2125 depend on a variety of factors.</p> 2126 <p class="note">Thus logically speaking, once a currency amount 2127 is entered into a system, it should be logically accompanied by 2128 a currency code in all processing. This currency code is 2129 independent of whatever the user's original locale was. Only in 2130 badly-designed software is the currency code (or equivalent) 2131 not present, so that the software has to "guess" at the 2132 currency code based on the user's locale.</p> 2133 <blockquote> 2134 <p class="note"><b>Note:</b> The number of decimal places 2135 <b>and</b> the rounding for each currency is not 2136 locale-specific data, and is not contained in the Locale Data 2137 Markup Language format. Those values override whatever is 2138 given in the currency numberFormat. For more information, see 2139 <i><a href="#Supplemental_Currency_Data">Supplemental 2140 Currency Data</a></i>.</p> 2141 </blockquote> 2142 <p>For background information on currency names, see [<a href= 2143 "tr35.html#CurrencyInfo">CurrencyInfo</a>].</p> 2144 <h3>4.1 <a name="Supplemental_Currency_Data" href= 2145 "#Supplemental_Currency_Data" id= 2146 "Supplemental_Currency_Data">Supplemental Currency 2147 Data</a></h3> 2148 <p class="dtd"><!ELEMENT currencyData ( fractions*, region+ 2149 ) ><br> 2150 <!ELEMENT fractions ( info+ ) ><br> 2151 <br> 2152 <!ELEMENT info EMPTY ><br> 2153 <!ATTLIST info iso4217 NMTOKEN #REQUIRED ><br> 2154 <!ATTLIST info digits NMTOKEN #IMPLIED ><br> 2155 <!ATTLIST info rounding NMTOKEN #IMPLIED ><br> 2156 <!ATTLIST info cashDigits NMTOKEN #IMPLIED ><br> 2157 <!ATTLIST info cashRounding NMTOKEN #IMPLIED ><br> 2158 <br> 2159 <!ELEMENT region ( currency* ) ><br> 2160 <!ATTLIST region iso3166 NMTOKEN #REQUIRED ><br> 2161 <br> 2162 <!ELEMENT currency ( alternate* ) ><br> 2163 <!ATTLIST currency from NMTOKEN #IMPLIED ><br> 2164 <!ATTLIST currency to NMTOKEN #IMPLIED ><br> 2165 <!ATTLIST currency iso4217 NMTOKEN #REQUIRED ><br> 2166 <!ATTLIST currency tender ( true | false ) #IMPLIED ></p> 2167 <p>Each currencyData element contains one fractions element 2168 followed by one or more region elements. Here is an example for 2169 illustration.</p> 2170 <pre><supplementalData> 2171 <currencyData> 2172 <fractions> 2173 … 2174 <info iso4217="CHF" digits="2" rounding="5"/> 2175 … 2176 <info iso4217="<span style= 2177"color: blue">ITL</span>" digits="<span style= 2178"color: blue">0</span>"/> 2179 … 2180 </fractions> 2181 … 2182 <region iso3166="IT"> 2183 <currency iso4217="EUR" from="1999-01-01"/> 2184 <currency iso4217="ITL" from="1862-8-24" to="2002-02-28"/> 2185 </region> 2186 … 2187 <region iso3166="CS"> 2188 <currency iso4217="EUR" from="2003-02-04"/> 2189 <currency iso4217="CSD" from="2002-05-15"/> 2190 <currency iso4217="YUM" from="1994-01-24" to="2002-05-15"/> 2191 </region> 2192 … 2193 </currencyData> 2194… 2195</supplementalData></pre> 2196 <p>The fractions element contains any number of info elements, 2197 with the following attributes:</p> 2198 <ul> 2199 <li><b>iso4217:</b> the ISO 4217 code for the currency in 2200 question. If a particular currency does not occur in the 2201 fractions list, then it is given the defaults listed for the 2202 next two attributes.</li> 2203 <li><b>digits:</b> the minimum and maximum number of decimal 2204 digits normally formatted. The default is 2. For example, in 2205 the en_US locale with the default value of 2 digits, the 2206 value 1 USD would format as "$1.00", and the value 1.123 USD 2207 would format as → "$1.12".</li> 2208 <li><b>rounding:</b> the rounding increment, in units of 2209 10<sup>-digits</sup>. The default is 0, which means no 2210 rounding is to be done. Therefore, rounding=0 and rounding=1 2211 have identical behavior. Thus with fraction digits of 2 and 2212 rounding increment of 5, numeric values are rounded to the 2213 nearest 0.05 units in formatting. With fraction digits of 0 2214 and rounding increment of 50, numeric values are rounded to 2215 the nearest 50.</li> 2216 <li><b>cashDigits:</b> the number of decimal digits to be 2217 used when formatting quantities used in cash transactions (as 2218 opposed to a quantity that would appear in a more formal 2219 setting, such as on a bank statement). If absent, the value 2220 of "digits" should be used as a default.</li> 2221 <li><b>cashRounding:</b> the cash rounding increment, in 2222 units of 10<sup>-cashDigits</sup>. The default is 0, which 2223 means no rounding is to be done; and as with rounding, this 2224 has the same effect as cashRounding="1". This is the rounding 2225 increment to be used when formatting quantities used in cash 2226 transactions (as opposed to a quantity that would appear in a 2227 more formal setting, such as on a bank statement). If absent, 2228 the value of "rounding" should be used as a default.</li> 2229 </ul> 2230 <p>For example, the following line</p> 2231 <pre> 2232 <info iso4217="CZK" digits="2" rounding="0"/></pre> 2233 <p>should cause the value 2.006 to be displayed as “2.01”, not 2234 “2.00”.</p> 2235 <p>Each region element contains one attribute:</p> 2236 <ul> 2237 <li><b>iso3166:</b> the ISO 3166 code for the region in 2238 question. The special value <i>XXX</i> can be used to 2239 indicate that the region has no valid currency or that the 2240 circumstances are unknown (usually used in conjunction with 2241 <i>before</i>, as described below).</li> 2242 </ul> 2243 <p>And can have any number of currency elements, with the 2244 ordered subelements.</p> 2245 <pre> <region iso3166="IT"> <!-- Italy --> 2246 <currency iso4217="EUR" from="2002-01-01"/> 2247 <currency iso4217="ITL" to="2001-12-31"/> 2248 </region></pre> 2249 <ul> 2250 <li><b>iso4217:</b> the ISO 4217 code for the currency in 2251 question. Note that some additional codes that were in 2252 widespread usage are included, others such as GHP are not 2253 included because they were never used.</li> 2254 <li><b>from:</b> the currency was valid from to the datetime 2255 indicated by the value. See the main document <i>Section 2256 5.2.1 <a href="tr35.html#Date_Ranges">Dates and Date 2257 Ranges</a></i> .</li> 2258 <li><b>to:</b> the currency was valid up to the datetime 2259 indicated by the value of <i>before</i>. See the main 2260 document <i>Section 5.2.1 <a href= 2261 "tr35.html#Date_Ranges">Dates and Date Ranges</a></i> .</li> 2262 <li> 2263 <p><b>tender:</b> indicates whether or not the ISO currency 2264 code represents a currency that was or is legal tender in 2265 some country. The default is "true". Certain ISO codes 2266 represent things like financial instruments or precious 2267 metals, and do not represent normally interchanged 2268 currencies.</p> 2269 </li> 2270 </ul> 2271 <p>That is, each currency element will list an interval in 2272 which it was valid. The <i>ordering</i> of the elements in the 2273 list tells us which was the primary currency during any period 2274 in time. Here is an example of such an overlap:</p> 2275 <pre><currency iso4217="CSD" to="2002-05-15"/> 2276<currency iso4217="YUD" from="1994-01-24" to="2002-05-15"/> 2277<currency iso4217="YUN" from="1994-01-01" to="1994-07-22"/></pre> 2278 <p>The <i>from</i> element is limited by the fact that ISO 4217 2279 does not go very far back in time, so there may be no ISO code 2280 for the previous currency.</p> 2281 <p>Currencies change relatively frequently. There are different 2282 types of changes:</p> 2283 <ol> 2284 <li>YU=>CS (name change)</li> 2285 <li>CS=>RS+ME (split, different names)</li> 2286 <li>SD=>SD+SS (split, same name for one // South Sudan 2287 splits from Sudan)</li> 2288 <li>DE+DD=>DE (Union, reuses one name // East Germany 2289 unifies with Germany)</li> 2290 </ol> 2291 <p>The 2292 <a href="https://unstats.un.org/unsd/methodology/m49/">UN 2293 Information</a> is used to determine dates due to country 2294 changes.</p><!-- Note: This moved from https://unstats.un.org/unsd/methods/m49/m49chang.htm#ftnq and the UN site now redirects to the above page. --> 2295 <p>When a code is no longer in use, it is terminated (see #1, 2296 #2, #4, #5)</p> 2297 <blockquote> 2298 <p>Example:</p> 2299 <ul> 2300 <li><currency iso4217="EUR" from="2003-02-04" 2301 to="2006-06-03"/></li> 2302 </ul> 2303 </blockquote> 2304 <p>When codes split, each of the new codes inherits (see #2, 2305 #3) the previous data. However, some modifications can be made 2306 if it is clear that currencies were only in use in one of the 2307 parts.</p> 2308 <p>When codes merge, the data is copied from the most populous 2309 part.</p> 2310 <blockquote> 2311 <p>Example. When CS split into RS and ME:</p> 2312 <ul> 2313 <li>RS & ME copy the former CS, except that the line 2314 for EUR is dropped from RS</li> 2315 <li>CS now terminates on Jun 3, 2006 (following the UN 2316 info)</li> 2317 </ul> 2318 </blockquote> 2319 <h2><a name="Language_Plural_Rules" href= 2320 "#Language_Plural_Rules" id="Language_Plural_Rules">5 Language 2321 Plural Rules</a></h2> 2322 <p class="dtd"><!ELEMENT plurals (pluralRules*, 2323 pluralRanges*) ><br> 2324 <!ATTLIST plurals type ( ordinal | cardinal ) #IMPLIED > 2325 <!-- default is cardinal --><br> 2326 <br> 2327 <!ELEMENT pluralRules (pluralRule*) ><br> 2328 <!ATTLIST pluralRules locales NMTOKENS #REQUIRED ><br> 2329 <br> 2330 <!ELEMENT pluralRule ( #PCDATA ) ><br> 2331 <!ATTLIST pluralRule count (zero | one | two | few | many | 2332 other) #REQUIRED ></p> 2333 <p>The plural categories are used to format messages with 2334 numeric placeholders, expressed as decimal numbers. The 2335 fundamental rule for determining plural categories is the 2336 existence of minimal pairs: whenever two different numbers may 2337 require different versions of the same message, then the 2338 numbers have different plural categories.</p> 2339 <p>This happens even if nouns are invariant; even if all 2340 English nouns were invariant (like “sheep”), English would 2341 still require 2 plural categories because of subject-verb 2342 agreement, and pronoun agreement. For example:</p> 2343 <ol> 2344 <li>1 sheep <strong>is</strong> here. Do you want to buy 2345 <strong>it</strong>?</li> 2346 <li>2 sheep <strong>are</strong> here. Do you want to buy 2347 <strong>them</strong>?</li> 2348 </ol> 2349 <p>For more information, see <a href= 2350 "http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories"> 2351 Determining-Plural-Categories</a>.</p> 2352 <p>English does not have a separate plural category for “zero”, 2353 because it does not require a different message for “0”. For 2354 example, the same message can be used below, with just the 2355 numeric placeholder changing.</p> 2356 <ol> 2357 <li> 2358 <p>You have 3 friends online.</p> 2359 </li> 2360 <li> 2361 <p>You have 0 friends online.</p> 2362 </li> 2363 </ol> 2364 <p>However, across many languages it is commonly more natural 2365 to express "0" messages with a negative (“None of your friends 2366 are online.”) and "1" messages also with an alternate form “You 2367 have a friend online.”. Thus pluralized message APIs should 2368 also offer the ability to specify at least the 0 and 1 cases 2369 explicitly; developers can use that ability whenever these 2370 values might occur in a placeholder.</p> 2371 <p>The CLDR plural rules are not expected to cover all cases. 2372 For example, strictly speaking, there could be more plural and 2373 ordinal forms for English. Formally, we have a different plural 2374 form where a change in digits forces a change in the rest of 2375 the sentence. There is an edge case in English because of the 2376 behavior of "a/an".</p> 2377 <p>For example, in changing from 3 to 8:</p> 2378 <ul> 2379 <li>"a 3rd of a loaf" should result in "an 8th of a loaf", 2380 not "a 8th of a loaf"</li> 2381 <li>"a 3 foot stick" should result in "an 8 foot stick", not 2382 "a 8 foot stick"</li> 2383 </ul> 2384 <p>So numbers of the following forms could have a special 2385 plural category and special ordinal category: 8(X), 11(X), 2386 18(X), 8x(X), where x is 0..9 and the optional X is 00, 000, 2387 00000, and so on.</p> 2388 <p>On the other hand, the above constructions are relatively 2389 rare in messages constructed using numeric placeholders, so the 2390 disruption for implementations currently using CLDR plural 2391 categories wouldn't be worth the small gain.</p> 2392 <p>This section defines the types of plural forms that exist in 2393 a language—namely, the cardinal and ordinal plural forms. 2394 Cardinal plural forms express units such as time, currency or 2395 distance, used in conjunction with a number expressed in 2396 decimal digits (i.e. "2", not "two", and not an indefinite 2397 number such as "some" or "many"). Ordinal plural forms denote 2398 the order of items in a set and are always integers. For 2399 example, English has two forms for cardinals:</p> 2400 <ul> 2401 <li>form "one": 1 day</li> 2402 <li>form "other": 0 days, 2 days, 10 days, 0.3 days</li> 2403 </ul> 2404 <p>and four forms for ordinals:</p> 2405 <ul> 2406 <li>form "one": 1st floor, 21st floor, 101st floor</li> 2407 <li>form "two": 2nd floor, 22nd floor, 102nd floor</li> 2408 <li>form "few": 3rd floor, 23rd floor, 103rd floor</li> 2409 <li>form "other": 4th floor, 11th floor, 96th floor</li> 2410 </ul> 2411 <p>Other languages may have additional forms or only one form 2412 for each type of plural. CLDR provides the following tags for 2413 designating the various plural forms of a language; for a given 2414 language, only the tags necessary for that language are 2415 defined, along with the specific numeric ranges covered by each 2416 tag (for example, the plural form "few" may be used for the 2417 numeric range 2–4 in one language and 3–9 in another):</p> 2418 <ul> 2419 <li>zero (see also plural case “0”, described in <a href= 2420 "#Explicit_0_1_rules">Explicit 0 and 1 rules</a>)</li> 2421 <li>one (see also plural case “1”, described in <a href= 2422 "#Explicit_0_1_rules">Explicit 0 and 1 rules</a>)</li> 2423 <li>two</li> 2424 <li>few</li> 2425 <li>many</li> 2426 </ul> 2427 <p>In addition, an "other" tag is always implicitly defined to 2428 cover the forms not explicitly designated by the tags defined 2429 for a language. This "other" tag is also used for languages 2430 that only have a single form (in which case no plural-form tags 2431 are explicitly defined for the language). For a more complex 2432 example, consider the cardinal rules for Russian and certain 2433 other languages:</p> 2434 <pre><pluralRules locales="hr ru sr uk"> 2435 <pluralRules count="one"><span style= 2436"color: blue">n mod 10 is 1 and n mod 100 is not 11</span></pluralRule> 2437 <pluralRules count="few"><span style= 2438"color: blue">n mod 10 in 2..4 and n mod 100 not in 12..14</span></pluralRule> 2439</pluralRules></pre> 2440 <p>These rules specify that Russian has a "one" form (for 1, 2441 21, 31, 41, 51, …), a "few" form (for 2–4, 22–24, 32–34, …), 2442 and implicitly an "other" form (for everything else: 0, 5–20, 2443 25–30, 35–40, …, decimals). Russian does not need additional 2444 separate forms for zero, two, or many, so these are not 2445 defined.</p> 2446 <p>A source number represents the visual appearance of the digits of the result. In text, it can be represented by the EBNF for decimalValue. Note that the same double number can be represented by multiple source numbers. For example, "1.0" and "1.00" are different source numbers, but there is only one double number that they correspond to: 1.0d == 1.00d. As another example, 1e3d == 1000d, but the source numbers "1e3" and "1000" are different, and can have different plural categories. So the input to the plural rules carries more information than a computer double. The plural category for negative numbers is calculated 2447 according to the absolute value of the source number, and leading integer digits don't have any effect on the plural category calculation. (This may change 2448 in the future, if we find languages that have different 2449 behavior.)</p> 2450 <p>Plural categories may also differ according to the visible 2451 decimals. For example, here are some of the behaviors exhibited 2452 by different languages:</p> 2453 <div dir="ltr"> 2454 <table> 2455 <!-- nocaption --> 2456 <tr> 2457 <th>Behavior</th> 2458 <th>Description</th> 2459 <th>Example</th> 2460 </tr> 2461 <tr> 2462 <td>Base</td> 2463 <td>The fractions are ignored; the category is the same 2464 as the category of the integer.</td> 2465 <td>1.13 has the same plural category as 1.</td> 2466 </tr> 2467 <tr> 2468 <td>Separate</td> 2469 <td>All fractions by value are in one category (typically 2470 ‘other’ = ‘plural’).</td> 2471 <td>1.01 gets the same class as 9;<br> 2472 1.00 gets the same category as 1.</td> 2473 </tr> 2474 <tr> 2475 <td>Visible</td> 2476 <td>All visible fractions are in one category (typically 2477 ‘other’ = ‘plural).</td> 2478 <td>1.00, 1.01, 3.5 all get the same category.</td> 2479 </tr> 2480 <tr> 2481 <td>Digits</td> 2482 <td>The visible fraction determines the category.</td> 2483 <td>1.13 gets the same class as 13.</td> 2484 </tr> 2485 </table> 2486 </div><br> 2487 <p>There are also variants of the above: for example, short 2488 fractions may have the Digits behavior, but longer fractions 2489 may just look at the final digit of the fraction.</p> 2490 <h4><a name="Explicit_0_1_rules" href="#Explicit_0_1_rules" id= 2491 "Explicit_0_1_rules">Explicit 0 and 1 rules</a></h4> 2492 <p>Some types of CLDR data (such as <a href= 2493 "tr35-general.html#Unit_Elements">unitPatterns</a> and <a href= 2494 "#Currencies">currency displayNames</a>) allow specification of 2495 plural rules for explicit cases “0” and “1”, in addition to the 2496 language-specific plural cases specified above: “zero”, “one”, 2497 “two” ... “other”. For the language-specific plural rules:</p> 2498 <ul> 2499 <li>The rules depend on language; for a given language, only 2500 a subset of the cases may be defined. For example, English 2501 only defines “one” and “other”, cases like “two” and “few” 2502 cannot be used in plurals for English CLDR items.</li> 2503 <li>Each plural case may cover multiple numeric values, and 2504 may depend on the formatting of those values. For example, in 2505 French the “one” case covers 0.0 through 1.99.</li> 2506 <li>The “one” case, if defined, includes at least some 2507 formatted forms of the numeric value 1; the “zero” case, if 2508 defined, includes at least some formatted forms of the 2509 numeric value 0.</li> 2510 </ul> 2511 <p>By contrast, for the explicit cases “0” and “1”:</p> 2512 <ul> 2513 <li>The explicit “0” and “1” cases are not defined by 2514 language-specific rules, and are available in any language 2515 for the CLDR data items that accept them.</li> 2516 <li>The explicit “0” and “1” cases apply to the exact numeric 2517 values 0 and 1 respectively. These cases are typically used 2518 for plurals of items that do not have fractional value, like 2519 books or files.</li> 2520 <li>The explicit “0” and “1” cases have precedence over the 2521 “zero” and “one” cases. For example, if for a particular 2522 element CLDR data includes values for both the “1” and “one” 2523 cases, then the “1” value is used for numeric values of 2524 exactly 1, while the “one” value is used for any other 2525 formatted numeric values matching the “one” plural rule for 2526 the language.</li> 2527 </ul> 2528 <p>Usage example: In English (which only defines 2529 language-specific rules for “one” and “other”) this can be used 2530 to have special behavior for 0:</p> 2531 <ul> 2532 <li>count=“0”: no books</li> 2533 <li>count=“one”: {0} book, e.g. “1 book”</li> 2534 <li>count=“other”: {0} books, e.g. “3 books”</li> 2535 </ul> 2536 <h3>5.1 <a name="Plural_rules_syntax" href= 2537 "#Plural_rules_syntax" id="Plural_rules_syntax">Plural rules 2538 syntax</a></h3> 2539 <p>The xml value for each pluralRule is a <em>condition</em> 2540 with a boolean result that specifies whether that rule (i.e. 2541 that plural form) applies to a given numeric value <em>n</em>, 2542 where n can be expressed as a decimal fraction or with compact decimal formatting, denoted by a special notation in the syntax, e.g., “1.2c6” for “1.2M”. Clients of CLDR 2543 may express all the rules for a locale using the following 2544 syntax:</p> 2545 <pre> 2546rules = rule (';' rule)* 2547rule = keyword ':' condition samples 2548 | 'other' ':' samples 2549keyword = [a-z]+ 2550keyword = [a-z]+ 2551 </pre> 2552 <p>In CLDR, the keyword is the attribute value of 'count'. 2553 Those values in CLDR are currently limited to just what is in 2554 the DTD, but clients may support other values.</p> 2555 <p>The conditions themselves have the following syntax.</p> 2556 <pre>condition = and_condition ('or' and_condition)* 2557samples = ('@integer' sampleList)? 2558 ('@decimal' sampleList)? 2559and_condition = relation ('and' relation)* 2560relation = is_relation | in_relation | within_relation 2561is_relation = expr 'is' ('not')? value 2562in_relation = expr (('not')? 'in' | '=' | '!=') range_list 2563within_relation = expr ('not')? 'within' range_list 2564expr = operand (('mod' | '%') value)? 2565operand = 'n' | 'i' | 'f' | 't' | 'v' | 'w' | 'c' | 'e' 2566range_list = (range | value) (',' range_list)* 2567range = value'..'value 2568value = digit+ 2569sampleList = sampleRange (',' sampleRange)* (',' ('…'|'...'))? 2570sampleRange = sampleValue ('~' sampleValue)? 2571sampleValue = value ('.' digit+)? ([ce] digitPos digit+)? 2572digit = [0-9] 2573digitPos = [1-9] 2574 </pre> 2575 <ul> 2576 <li>Whitespace (defined as Unicode <a href= 2577 "https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5Cp%7BPattern_White_Space%7D"> 2578 Pattern_White_Space</a>) can occur between or around any of 2579 the above tokens, with the exception of the tokens in value, 2580 digit, and decimalValue.</li> 2581 <li>In the syntax, <strong>and</strong> binds more tightly 2582 than <strong>or</strong>. So <strong>X or Y and Z</strong> is 2583 interpreted as <strong>(X or (Y and Z))</strong>.</li> 2584 <li>Each plural rule must be written to be self-contained, 2585 and not depend on the ordering. Thus rules must be mutually 2586 exclusive; for a given numeric value, only one rule can apply 2587 (i.e., the condition can only be true for one of the 2588 pluralRule elements. Each keyword can have at most one 2589 condition. The 'other' keyword must have an empty condition: 2590 it is only present for samples.</li> 2591 <li>The samples should be included, since they are used by 2592 client software for samples and determining whether the 2593 keyword has finite values or not.</li> 2594 <li>The 'other' keyword must have no condition, and all other 2595 keywords must have a condition.</li> 2596 </ul> 2597 <h4><a name="Operands" href="#Operands" id="Operands">5.1.1 2598 Operands</a></h4> 2599 <p>The operands correspond to features of the source number, and have the following meanings. </p> 2600 <div dir="ltr"> 2601 <table class='simple'> 2602 <caption> 2603 <a name="Plural_Operand_Meanings" href= 2604 "#Plural_Operand_Meanings" id= 2605 "Plural_Operand_Meanings">Plural Operand Meanings</a> 2606 </caption> 2607 <tr> 2608 <th>Symbol</th> 2609 <th>Value</th> 2610 </tr> 2611 <tr> 2612 <td>n</td> 2613 <td>absolute value of the source number.</td> 2614 </tr> 2615 <tr> 2616 <td>i</td> 2617 <td>integer digits of n.</td> 2618 </tr> 2619 <tr> 2620 <td>v</td> 2621 <td>number of visible fraction digits in n, <em>with</em> 2622 trailing zeros.*</td> 2623 </tr> 2624 <tr> 2625 <td>w</td> 2626 <td>number of visible fraction digits in n, 2627 <em>without</em> trailing zeros.*</td> 2628 </tr> 2629 <tr> 2630 <td>f</td> 2631 <td>visible fraction digits in n, <em>with</em> 2632 trailing zeros.*</td> 2633 </tr> 2634 <tr> 2635 <td>t</td> 2636 <td>visible fraction digits in n, <em>without</em> 2637 trailing zeros.*</td> 2638 </tr> 2639 <tr> 2640 <td>c</td> 2641 <td>compact decimal exponent value: exponent of the power of 10 used in compact decimal formatting.</td> 2642 </tr> 2643 <tr> 2644 <td>e</td> 2645 <td>currently, synonym for ‘c’. however, may be redefined in the future.</td> 2646 </tr> 2647 </table> 2648 </div> 2649 <p>* If there is a compact decimal exponent value (‘c’), then the f, t, v, and w values are computed <em>after</em> shifting the decimal point in the original by the ‘c’ value. So for 1.2c3, the f, t, v, and w values are the same as those of 1200: i=1200 and f=0. Similarly, for 1.2005c3 has i=1200 and f=5 (corresponding to 1200.5).</p> 2650 <div dir="ltr"> 2651 <table class='simple' width='30em'> 2652 <caption> 2653 <a name="Plural_Operand_Examples" href= 2654 "#Plural_Operand_Examples" id= 2655 "Plural_Operand_Examples">Plural Operand Examples</a> 2656 </caption> 2657<tr> 2658<th style='text-align: right'>source</th> 2659 <th style='text-align: right'>n</th> 2660 <th style='text-align: right'>i</th> 2661 <th style='text-align: right'>v</th> 2662 <th style='text-align: right'>w</th> 2663 <th style='text-align: right'>f</th> 2664 <th style='text-align: right'>t</th> 2665 <th style='text-align: right'>e</th> 2666</tr> 2667<tr> 2668<td style='text-align: right'>1</td> 2669 <td style='text-align:right'>1</td> 2670 <td style='text-align: right'>1</td> 2671 <td style='text-align: right'>0</td> 2672 <td style='text-align: right'>0</td> 2673 <td style='text-align: right'>0</td> 2674 <td style='text-align: right'>0</td> 2675 <td style='text-align:right'>0</td> 2676</tr> 2677<tr> 2678<td style='text-align: right'>1.0</td> 2679 <td style='text-align:right'>1</td> 2680 <td style='text-align: right'>1</td> 2681 <td style='text-align: right'>1</td> 2682 <td style='text-align: right'>0</td> 2683 <td style='text-align: right'>0</td> 2684 <td style='text-align: right'>0</td> 2685 <td style='text-align:right'>0</td> 2686</tr> 2687<tr> 2688<td style='text-align: right'>1.00</td> 2689 <td style='text-align:right'>1</td> 2690 <td style='text-align: right'>1</td> 2691 <td style='text-align: right'>2</td> 2692 <td style='text-align: right'>0</td> 2693 <td style='text-align: right'>0</td> 2694 <td style='text-align: right'>0</td> 2695 <td style='text-align:right'>0</td> 2696</tr> 2697<tr> 2698<td style='text-align: right'>1.3</td> 2699 <td style='text-align:right'>1.3</td> 2700 <td style='text-align: right'>1</td> 2701 <td style='text-align: right'>1</td> 2702 <td style='text-align: right'>1</td> 2703 <td style='text-align: right'>3</td> 2704 <td style='text-align: right'>3</td> 2705 <td style='text-align:right'>0</td> 2706</tr> 2707<tr> 2708<td style='text-align: right'>1.30</td> 2709 <td style='text-align:right'>1.3</td> 2710 <td style='text-align: right'>1</td> 2711 <td style='text-align: right'>2</td> 2712 <td style='text-align: right'>1</td> 2713 <td style='text-align: right'>30</td> 2714 <td style='text-align: right'>3</td> 2715 <td style='text-align:right'>0</td> 2716</tr> 2717<tr> 2718<td style='text-align: right'>1.03</td> 2719 <td style='text-align:right'>1.03</td> 2720 <td style='text-align: right'>1</td> 2721 <td style='text-align: right'>2</td> 2722 <td style='text-align: right'>2</td> 2723 <td style='text-align: right'>3</td> 2724 <td style='text-align: right'>3</td> 2725 <td style='text-align:right'>0</td> 2726</tr> 2727<tr> 2728<td style='text-align: right'>1.230</td> 2729 <td style='text-align:right'>1.23</td> 2730 <td style='text-align: right'>1</td> 2731 <td style='text-align: right'>3</td> 2732 <td style='text-align: right'>2</td> 2733 <td style='text-align: right'>230</td> 2734 <td style='text-align: right'>23</td> 2735 <td style='text-align:right'>0</td> 2736</tr> 2737<tr> 2738<td style='text-align:right'>1200000</td> 2739 <td style='text-align:right'>1200000</td> 2740 <td style='text-align:right'>1200000</td> 2741 <td style='text-align:right'>0</td> 2742 <td style='text-align:right'>0</td> 2743 <td style='text-align:right'>0</td> 2744 <td style='text-align:right'>0</td> 2745 <td style='text-align:right'>0</td> 2746</tr> 2747<tr> 2748<td style='text-align:right'>1.2c6</td> 2749 <td style='text-align:right'>1200000</td> 2750 <td style='text-align:right'>1200000</td> 2751 <td style='text-align:right'>0</td> 2752 <td style='text-align:right'>0</td> 2753 <td style='text-align:right'>0</td> 2754 <td style='text-align:right'>0</td> 2755 <td style='text-align:right'>6</td> 2756</tr> 2757<tr> 2758<td style='text-align:right'>123c6</td> 2759 <td style='text-align:right'>123000000</td> 2760 <td style='text-align:right'>123000000</td> 2761 <td style='text-align:right'>0</td> 2762 <td style='text-align:right'>0</td> 2763 <td style='text-align:right'>0</td> 2764 <td style='text-align:right'>0</td> 2765 <td style='text-align:right'>6</td> 2766</tr> 2767<tr> 2768<td style='text-align:right'>123c5</td> 2769 <td style='text-align:right'>12300000</td> 2770 <td style='text-align:right'>12300000</td> 2771 <td style='text-align:right'>0</td> 2772 <td style='text-align:right'>0</td> 2773 <td style='text-align:right'>0</td> 2774 <td style='text-align:right'>0</td> 2775 <td style='text-align:right'>5</td> 2776</tr> 2777<tr> 2778<td style='text-align:right'>1200.50</td> 2779 <td style='text-align:right'>1200.5</td> 2780 <td style='text-align:right'>1200</td> 2781 <td style='text-align:right'>2</td> 2782 <td style='text-align:right'>1</td> 2783 <td style='text-align:right'>50</td> 2784 <td style='text-align:right'>5</td> 2785 <td style='text-align:right'>0</td> 2786</tr> 2787<tr> 2788<td style='text-align:right'>1.20050c3</td> 2789 <td style='text-align:right'>1200.5</td> 2790 <td style='text-align:right'>1200</td> 2791 <td style='text-align:right'>2</td> 2792 <td style='text-align:right'>1</td> 2793 <td style='text-align:right'>50</td> 2794 <td style='text-align:right'>5</td> 2795 <td style='text-align:right'>3</td> 2796</tr> 2797 </table> 2798 </div><br> 2799 <h4><a name="Relations" href="#Relations" id="Relations">5.1.2 2800 Relations</a></h4> 2801 <p>The positive relations are of the format <strong>x = 2802 y</strong> and <strong>x = y mod z</strong>. The 2803 <strong>y</strong> value can be a comma-separated list, such as 2804 <strong>n = 3, 5, 7..15</strong>, and is treated as if each 2805 relation were expanded into an OR statement. The range value 2806 <strong>a..b</strong> is equivalent to listing all the 2807 <em><strong>integers</strong></em> between <strong>a</strong> 2808 and <strong>b</strong>, inclusive. When <strong>!=</strong> is 2809 used, it means the entire relation is negated.</p> 2810 <table class='simple'> 2811 <caption> 2812 <a name="Relations_Examples" href="#Relations_Examples" id= 2813 "Relations_Examples">Relations Examples</a> 2814 </caption> 2815 <tr> 2816 <th>Expression</th> 2817 <th>Meaning</th> 2818 </tr> 2819 <tr> 2820 <td>x = 2..4, 15</td> 2821 <td>x = 2 OR x = 3 OR x = 4 OR x = 15</td> 2822 </tr> 2823 <tr> 2824 <td>x != 2..4, 15</td> 2825 <td>NOT (x = 2 OR x = 3 OR x = 4 OR x = 15)</td> 2826 </tr> 2827 </table><br> 2828 <table class='simple'> 2829 <!-- nocaption --> 2830 <tr> 2831 <th>Expression</th> 2832 <th>Value</th> 2833 </tr> 2834 <tr> 2835 <td>3.5 = 2..4, 15</td> 2836 <td>false</td> 2837 </tr> 2838 <tr> 2839 <td nowrap>3.5 != 2..4, 15</td> 2840 <td>true</td> 2841 </tr> 2842 <tr> 2843 <td>3 = 2..4, 15</td> 2844 <td>true</td> 2845 </tr> 2846 <tr> 2847 <td>3 != 2..4, 15</td> 2848 <td>false</td> 2849 </tr> 2850 </table> 2851 <blockquote> 2852 <p>The old keywords 'mod', 'in', 'is', and 'within' are 2853 present only for backwards compatibility. The preferred form 2854 is to use '%' for modulo, and '=' or '!=' for the relations, 2855 with the operand 'i' instead of within. (The difference 2856 between <strong>in</strong> and <strong>within</strong> is 2857 that <strong>in</strong> only includes integers in the 2858 specified range, while <strong>within</strong> includes all 2859 values.)</p> 2860 </blockquote> 2861 <p dir="ltr">The modulus (% or <strong>mod</strong>) is a 2862 remainder operation as defined in Java; for example, where 2863 <strong>n</strong> = 4.3 the result of <strong>n mod 3</strong> 2864 is 1.3.</p> 2865 <p>The values of relations are defined according to the operand 2866 as follows. Importantly, the results may depend on the visible 2867 decimals in the source, including trailing zeros, and the compact decimal exponent.</p> 2868 <ol> 2869 <li>Let the base value BV be computed from absolute value of 2870 the original source number according to the operand.</li> 2871 <li>Let R be false when the comparison contains ‘not’.</li> 2872 <li>Let R be !R if the comparison contains ‘within’ and 2873 the source number is not an integer.</li> 2874 <li>If there is a module value MV, let BV be BV - 2875 floor(BV/MV).</li> 2876 <li>Let CR be the list of comparison ranges, normalized that 2877 overlapping ranges are merged. Single values in the rule are 2878 represented by a range with identical <start<sub>i</sub>, 2879 end<sub>i</sub>> values.</li> 2880 <li>Iterate through CR: 2881 <ul> 2882 <li>if start<sub>i</sub> ≤ BV ≤ end<sub>i</sub> then 2883 return R.</li> 2884 </ul> 2885 </li> 2886 <li>Otherwise return !R.</li> 2887 </ol> 2888 <table border="1"> 2889 <caption> 2890 <a name="Plural_Rules_Examples" href= 2891 "#Plural_Rules_Examples" id="Plural_Rules_Examples">Plural 2892 Rules Examples</a> 2893 </caption> 2894 <tr> 2895 <th>Rules</th> 2896 <th>Comments</th> 2897 </tr> 2898 <tr> 2899 <td nowrap>one: n = 1<br> 2900 few: n = 2..4</td> 2901 <td>This defines two rules, for 'one' and 'few'. The 2902 condition for 'one' is "n = 1" which means that the number 2903 must be equal to 1 for this condition to pass. The 2904 condition for 'few' is "n = 2..4" which means that the 2905 number must be between 2 and 4 inclusive for this condition 2906 to pass. All other numbers are assigned the keyword 'other' 2907 by the default rule.</td> 2908 </tr> 2909 <tr> 2910 <td nowrap>zero: n = 0 or n != 1 and n mod 100 = 1..19<br> 2911 one: n = 1</td> 2912 <td>Each rule must not overlap with other rules. Also note 2913 that a modulus is applied to n in the last rule, thus its 2914 condition holds for 119, 219, 319…</td> 2915 </tr> 2916 <tr> 2917 <td nowrap>one: n = 1<br> 2918 few: n mod 10 = 2..4 and n mod 100 != 12..14</td> 2919 <td>This illustrates conjunction and negation. The 2920 condition for 'few' has two parts, both of which must be 2921 met: "n mod 10 = 2..4" and "n mod 100 != 12..14". The first 2922 part applies a modulus to n before the test as in the 2923 previous example. The second part applies a different 2924 modulus and also uses negation, thus it matches all numbers 2925 <em>not</em> in 12, 13, 14, 112, 113, 114, 212, 213, 2926 214…</td> 2927 </tr> 2928 </table> 2929 <h4><a name="Samples" href="#Samples" id="Samples">5.1.3 2930 Samples</a></h4> 2931 <p>Samples are provided if sample indicator (@integer or 2932 @decimal) is present on any rule. (CLDR always provides 2933 samples.)</p> 2934 <p>Where samples are provided, the absence of one of the sample 2935 indicators indicates that no numeric values can satisify that 2936 rule. For example, the rule "i = 1 and v = 0" can only have 2937 integer samples, so @decimal must not occur. The @integer samples have no visible fraction digits, while @decimal samples have visible fraction digits; both can have compact decimal exponent values (if the 'e' operand occurs).</p> 2938 <p>The sampleRanges have a special notation: 2939 <strong>start</strong>~<strong>end</strong>. The 2940 <strong>start</strong> and <strong>end</strong> values must 2941 have the same number of decimal digits, and the same compact decimal exponent values (or neither have compact decimal exponent values). The range encompasses 2942 all and only values those value <strong>v</strong> where 2943 <strong>start ≤ v ≤ end</strong>, and where <strong>v</strong> 2944 has the same number of decimal places as <strong>start</strong> 2945 and <strong>end</strong>, and the same compact decimal exponent values.</p> 2946 <p>Samples must indicate whether they are infinite or not. The 2947 '…' marker must be present if and only infinitely many values 2948 (integer or decimal) can satisfy the rule. If a set is not 2949 infinite, it must list all the possible values.</p> 2950 <table border="1"> 2951 <caption> 2952 <a name="Plural_Samples_Examples" href= 2953 "#Plural_Samples_Examples" id= 2954 "Plural_Samples_Examples">Plural Samples Examples</a> 2955 </caption> 2956 <tr> 2957 <th>Rules</th> 2958 <th>Comments</th> 2959 </tr> 2960 <tr> 2961 <td nowrap>@integer 1, 3~5</td> 2962 <td>1, 3, 4, 5.</td> 2963 </tr> 2964 <tr> 2965 <td nowrap>@integer 3~5, 103~105, …</td> 2966 <td>Infinite set: 3, 4, 5, 103, 104, 105, …</td> 2967 </tr> 2968 <tr> 2969 <td nowrap>@decimal 1.3~1.5, 1.03~1.05, …</td> 2970 <td>Infinite set: 1.3, 1.4, 1.5, 1.03, 1.04, 1.05, …</td> 2971 </tr> 2972 </table><br> 2973 <p>In determining whether a set of samples is infinite, leading 2974 zero integer digits and trailing zero decimals are not 2975 significant. Thus "i = 1000 and f = 0" is satisfied by 01000, 1000, 1000.0, 2976 1000.00, 1000.000, 01c3 etc. but is still considered finite.</p> 2977 <h4><a name="Using_cardinals" href="#Using_cardinals" id= 2978 "Using_cardinals">5.1.4 Using Cardinals</a></h4> 2979 <p>Elements such as <currencyFormats>, <currency> 2980 and <unit> provide selection among subelements 2981 designating various localized cardinal plural forms by tagging 2982 each of the relevant subelements with a different count value, 2983 or with no count value in some cases. Note that the plural 2984 forms for a specific currencyFormat, unit type, or currency 2985 type may not use all of the different plural-form tags defined 2986 for the language. To format a currency or unit type for a 2987 particular numeric value, determine the count value according 2988 to the plural rules for the language, then select the 2989 appropriate display form for the currency format, currency type 2990 or unit type using the rules in those sections:</p> 2991 <ul> 2992 <li>2.3 <a href="#Number_Symbols">Number Symbols</a> (for 2993 currencyFormats elements)</li> 2994 <li>Section 4 <a href="#Currencies">Currencies</a> (for 2995 currency elements)</li> 2996 <li>The main document section 5.11 <a href= 2997 "tr35.html#Unit_Elements">Unit Elements</a></li> 2998 </ul> 2999 <h3>5.2 <a name="Plural_Ranges" href="#Plural_Ranges" id= 3000 "Plural_Ranges">Plural Ranges</a></h3> 3001 <p class="dtd"><!ELEMENT pluralRanges (pluralRange*) 3002 ><br> 3003 <!ATTLIST pluralRanges locales NMTOKENS #REQUIRED ><br> 3004 <br> 3005 <!ELEMENT pluralRange ( #PCDATA ) ><br> 3006 <!ATTLIST pluralRange start (zero|one|two|few|many|other) 3007 #IMPLIED ><br> 3008 <!ATTLIST pluralRange end (zero|one|two|few|many|other) 3009 #IMPLIED ><br> 3010 <!ATTLIST pluralRange result (zero|one|two|few|many|other) 3011 #REQUIRED ></p> 3012 <p>Often ranges of numbers are presented to users, such as in 3013 “Length: 3.2–4.5 centimeters”. This means any length from 3.2 3014 cm to 4.5 cm, inclusive. However, different languages have 3015 different conventions for the pluralization given to a range: 3016 should it be “0–1 centimeter” or “0–1 centimeters”? This 3017 becomes much more complicated for languages that have many 3018 different plural forms, such as Russian or Arabic.</p> 3019 <p>The <strong>pluralRanges</strong> element provides 3020 information allowing an implementation to derive the plural 3021 category of a range from the plural categories of the 3022 <em>start</em> and <em>end</em> values. If there is no value 3023 for a <em><start,end></em> pair, the default result is 3024 <em>end</em>. However, where that result has been verified for 3025 a given language, it is included in the CLDR data.</p> 3026 <p>The data has been gathered presuming that in any usage, the 3027 start value is strictly less than the end value, and that no 3028 values are negative. Results for any cases that do not meet 3029 these criteria are undefined.</p> 3030 <h2>6 <a name="Rule-Based_Number_Formatting" href= 3031 "#Rule-Based_Number_Formatting" id= 3032 "Rule-Based_Number_Formatting">Rule-Based Number 3033 Formatting</a></h2> 3034 <p class="dtd"><!ELEMENT rbnf ( alias | rulesetGrouping*) 3035 ><br> 3036 <br> 3037 <!ELEMENT rulesetGrouping ( alias | ruleset*) ><br> 3038 <!ATTLIST rulesetGrouping type NMTOKEN #REQUIRED><br> 3039 <br> 3040 <!ELEMENT ruleset ( alias | rbnfrule*) ><br> 3041 <!ATTLIST ruleset type NMTOKEN #REQUIRED><br> 3042 <!ATTLIST ruleset access ( public | private ) #IMPLIED 3043 ><br> 3044 <br> 3045 <!ELEMENT rbnfrule ( #PCDATA ) ><br> 3046 <!ATTLIST rbnfrule value CDATA #REQUIRED ><br> 3047 <!ATTLIST rbnfrule radix CDATA #IMPLIED ><br> 3048 <!ATTLIST rbnfrule decexp CDATA #IMPLIED ></p> 3049 <p>The rule-based number format (RBNF) encapsulates a set of 3050 rules for mapping binary numbers to and from a readable 3051 representation. They are typically used for spelling out 3052 numbers, but can also be used for other number systems like 3053 roman numerals, Chinese numerals, or for ordinal numbers (1st, 3054 2nd, 3rd,…).</p> 3055 <p>Where, however, the CLDR plurals or ordinals can be used, 3056 their usage is recommended in preference to the RBNF data. 3057 First, the RBNF data is not completely fleshed out over all 3058 languages that otherwise have modern coverage. Secondly, the 3059 alternate forms are neither complete, nor useful without 3060 additional information. For example, for German there is 3061 spellout-cardinal-masculine, and spellout-cardinal-feminine. 3062 But a complete solution would have all genders 3063 (masculine/feminine/neuter), all cases (nominative, accusative, 3064 dative, genitive), plus context (with strong or weak determiner 3065 or none). Moreover, even for the alternate forms that do exist, 3066 CLDR does not supply any data for when to use one vs another 3067 (eg, when to use spellout-cardinal-masculine vs 3068 spellout-cardinal-feminine). So these data are inappropriate 3069 for general purpose software.</p> 3070 <p>There are 4 common spellout rules. Some languages may 3071 provide more than these 4 types:<br></p> 3072 <ul> 3073 <li><strong>numbering:</strong> This is the default used when 3074 there is no context for the number. For many languages, this 3075 may also be used for enumeration of objects, like used when 3076 pronouncing "table number one" and "table number two". It can 3077 also be used for pronouncing a math equation, like "2 - 3 = 3078 -1".</li> 3079 <li><strong>numbering-year:</strong> This is used for cases 3080 where years are pronounced or written a certain way. An 3081 example in English is the year 1999, which comes out as 3082 "nineteen ninety-nine" instead of the numbering value "one 3083 thousand nine hundred ninety-nine". The rules for this type 3084 have undefined behavior for non-integer numbers, and values 3085 less than 1.</li> 3086 <li><strong>cardinal:</strong> This is used when providing 3087 the quantity of the number of objects. For many languages, 3088 there may not be a default cardinal type. Many languages 3089 require the notion of the gender and other grammatical 3090 properties so that the number and the objects being 3091 referenced are in grammatical agreement. An example of its 3092 usage is "one e-mail", "two people" or "three kilometers". 3093 Some languages may not have dedicated words for 0 or negative 3094 numbers for cardinals. In those cases, the words from the 3095 numbering type can be reused.</li> 3096 <li><strong>ordinal:</strong> This is used when providing the 3097 order of the number of objects. For many languages, there may 3098 not be a default ordinal type. Many languages also require 3099 the notion of the gender for ordinal so that the ordinal 3100 number and the objects being referenced are in grammatical 3101 agreement. An example of its usage is "first place", "second 3102 e-mail" or "third house on the right". The rules for this 3103 type have undefined behavior for non-integer numbers, and 3104 values less than 1.</li> 3105 </ul> 3106 <p>In addition to the spellout rules, there are also a 3107 numbering system rules. Even though they may be derived from a 3108 specific culture, they are typically not translated and the 3109 rules are in <strong>root</strong>. An example of these rules 3110 are the Roman numerals where the value 8 comes out as 3111 VIII.<br></p> 3112 <p>With regards to the number range supported for all these 3113 number types, the largest possible number range tries to be 3114 supported, but some languages may not have words for large 3115 numbers. For example, the old Roman numbering system can't 3116 support the value 5000 and beyond. For those unsupported cases, 3117 the default number format from CLDR is used.<br></p> 3118 <p>Any rules marked as <strong>private</strong> should never be 3119 referenced externally. Frequently they only support a subrange 3120 of numbers that are used in the public rules.<br></p> 3121 <p>The syntax used in the CLDR representation of rules is 3122 intended to be simply a transcription of ICU based RBNF rules 3123 into an XML compatible syntax. The rules are fairly 3124 sophisticated; for details see <i>Rule-Based Number 3125 Formatter</i> [<a href="tr35.html#RBNF">RBNF</a>].</p> 3126 <p class="dtd"><ruleSetGrouping></p> 3127 <p>Used to group rules into functional sets for use with ICU. 3128 Currently, the valid types of rule set groupings are 3129 "SpelloutRules", "OrdinalRules", and 3130 "NumberingSystemRules".</p> 3131 <p class="dtd"><ruleset></p> 3132 <p>This element denotes a specific rule set to the number 3133 formatter. The ruleset is assumed to be a public ruleset unless 3134 the attribute type="private" is specified.</p> 3135 <p class="dtd"><rule></p> 3136 <p>Contains the actual formatting rule for a particular number 3137 or sequence of numbers. The "value" attribute is used to 3138 indicate the starting number to which the rule applies. The 3139 actual text of the rule is identical to the ICU syntax, with 3140 the exception that Unicode left and right arrow characters are 3141 used to replace < and > in the rule text, since < and 3142 > are reserved characters in XML. The "radix" attribute is 3143 used to indicate an alternate radix to be used in calculating 3144 the prefix and postfix values for number formatting. Alternate 3145 radix values are typically used for formatting year numbers in 3146 formal documents, such as "nineteen hundred seventy-six" 3147 instead of "one thousand nine hundred seventy-six".</p> 3148 <h2><a name="Parsing_Numbers" href="#Parsing_Numbers" id= 3149 "Parsing_Numbers">7 Parsing Numbers</a></h2> 3150 <p>The following elements are relevant to determining the value 3151 of a parsed number:</p> 3152 <ul> 3153 <li>A possible prefix or suffix, indicating sign</li> 3154 <li>A possible currency symbol or code</li> 3155 <li>Decimal digits</li> 3156 <li>A possible decimal separator</li> 3157 <li>A possible exponent</li> 3158 <li>A possible percent or per mille character</li> 3159 </ul> 3160 <p>Other characters should either be ignored, or indicate the 3161 end of input, depending on the application. The key point is to 3162 disambiguate the sets of characters that might serve in more 3163 than one position, based on context. For example, a period 3164 might be either the decimal separator, or part of a currency 3165 symbol (for example, "NA f."). Similarly, an "E" could be an 3166 exponent indicator, or a currency symbol (the Swaziland 3167 Lilangeni uses "E" in the "en" locale). An apostrophe might be 3168 the decimal separator, or might be the grouping separator.</p> 3169 <p>Here is a set of heuristic rules that may be helpful:</p> 3170 <ul> 3171 <li>Any character with the decimal digit property is 3172 unambiguous and should be accepted. 3173 <p><b>Note:</b> In some environments, applications may 3174 independently wish to restrict the decimal digit set to 3175 prevent security problems. See [<a href= 3176 "https://www.unicode.org/reports/tr41/#UTR36">UTR36</a>].</p> 3177 </li> 3178 <li>The exponent character can only be interpreted as such if 3179 it occurs after at least one digit, and if it is followed by 3180 at least one digit, with only an optional sign in between. A 3181 regular expression may be helpful here.</li> 3182 <li>For the sign, decimal separator, percent, and per mille, 3183 use a set of all possible characters that can serve those 3184 functions. For example, the decimal separator set could 3185 include all of [.,']. (The actual set of characters can be 3186 derived from the number symbols in the By-Type charts 3187 <a href="tr35.html#ByType">[ByType]</a>, which list all of 3188 the values in CLDR.) To disambiguate, the decimal separator 3189 for the locale must be removed from the "ignore" set, and the 3190 grouping separator for the locale must be removed from the 3191 decimal separator set. The same principle applies to all sets 3192 and symbols: any symbol must appear in at most one set.</li> 3193 <li>Since there are a wide variety of currency symbols and 3194 codes, this should be tried before the less ambiguous 3195 elements. It may be helpful to develop a set of characters 3196 that can appear in a symbol or code, based on the currency 3197 symbols in the locale.</li> 3198 <li>Otherwise, a character should be ignored unless it is in 3199 the "stop" set. This includes even characters that are 3200 meaningful for formatting, for example, the grouping 3201 separator.</li> 3202 <li>If more than one sign, currency symbol, exponent, or 3203 percent/per mille occurs in the input, the first found should 3204 be used.</li> 3205 <li>A currency symbol in the input should be interpreted as 3206 the longest match found in the set of possible currency 3207 symbols.</li> 3208 <li>Especially in cases of ambiguity, the user's input should 3209 be echoed back, properly formatted according to the locale, 3210 before it is actually used for anything.</li> 3211 </ul> 3212 <hr> 3213 <p class="copyright">Copyright © 2001–2020 Unicode, Inc. All 3214 Rights Reserved. The Unicode Consortium makes no expressed or 3215 implied warranty of any kind, and assumes no liability for 3216 errors or omissions. No liability is assumed for incidental and 3217 consequential damages in connection with or arising out of the 3218 use of the information or programs contained or accompanying 3219 this technical report. The Unicode <a href= 3220 "https://unicode.org/copyright.html">Terms of Use</a> apply.</p> 3221 <p class="copyright">Unicode and the Unicode logo are 3222 trademarks of Unicode, Inc., and are registered in some 3223 jurisdictions.</p> 3224 </div> 3225</body> 3226</html> 3227