Skip to content

Instantly share code, notes, and snippets.

@steveluscher
Last active April 30, 2021 21:28
Show Gist options
  • Save steveluscher/4b54e08aa1e0536b7cb9 to your computer and use it in GitHub Desktop.
Save steveluscher/4b54e08aa1e0536b7cb9 to your computer and use it in GitHub Desktop.

Revisions

  1. steveluscher revised this gist Feb 24, 2015. No changes.
  2. steveluscher revised this gist Feb 24, 2015. No changes.
  3. steveluscher revised this gist Feb 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -84,4 +84,4 @@ console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximum
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.</dd>
    </dl>

    (_Prior art: http://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html)
    (_Prior art: http://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html_)
  4. steveluscher revised this gist Feb 24, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -82,4 +82,6 @@ console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximum

    <dt>Intl.NumberFormat.ROUND_HALF_DOWN</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.</dd>
    </dl>
    </dl>

    (_Prior art: http://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html)
  5. steveluscher revised this gist Feb 24, 2015. No changes.
  6. steveluscher revised this gist Feb 24, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -51,10 +51,10 @@ console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximum
    ```

    ### Addendum
    ## Addendum

    <a name="roundingmodes"></a>
    #### Rounding modes
    ### Rounding modes
    <dl>
    <dt>Intl.NumberFormat.ROUND_CEILING</dt>
    <dd>Rounding mode to round towards positive infinity.</dd>
  7. steveluscher revised this gist Feb 24, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -51,6 +51,8 @@ console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximum
    ```

    ### Addendum

    <a name="roundingmodes"></a>
    #### Rounding modes
    <dl>
  8. steveluscher revised this gist Feb 24, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,8 @@ var number = 1234567.89;
    // abbreviate a number
    console.log(new Intl.NumberFormat('en-US', { abbreviationThreshold: 1e6, maximumSignificantDigits: 3 }).format(number));
    // → 1.23M
    console.log(new Intl.NumberFormat('en-US', { abbreviationThreshold: 1e6, style: 'currency', maximumSignificantDigits: 3 }).format(number));
    // → $1.23M
    console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximumSignificantDigits: 3 }).format(number));
    // → 123万
  9. steveluscher revised this gist Feb 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. Possible values are from <code>0</code> to <code>Infinity</code>; the default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code class="highlight highlight-javascript">Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <code>Intl.NumberFormat.ROUND_HALF_CEILING</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <code>Intl.NumberFormat.ROUND_HALF_CEILING</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    </dl>
    </dd>
  10. steveluscher revised this gist Feb 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. Possible values are from <code>0</code> to <code>Infinity</code>; the default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code class="language-js">Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <code>Intl.NumberFormat.ROUND_HALF_CEILING</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code class="highlight highlight-javascript">Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <code>Intl.NumberFormat.ROUND_HALF_CEILING</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    </dl>
    </dd>
  11. steveluscher revised this gist Feb 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. Possible values are from <code>0</code> to <code>Infinity</code>; the default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is Intl.NumberFormat.ROUND_HALF_CEILING. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code class="language-js">Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <code>Intl.NumberFormat.ROUND_HALF_CEILING</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    </dl>
    </dd>
  12. steveluscher revised this gist Feb 24, 2015. 1 changed file with 12 additions and 6 deletions.
    18 changes: 12 additions & 6 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. Possible values are from <code>0</code> to <code>Infinity</code>; the default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <mark>???</mark>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is Intl.NumberFormat.ROUND_HALF_CEILING. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    </dl>
    </dd>
    @@ -63,13 +63,19 @@ console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximum

    <dt>Intl.NumberFormat.ROUND_UP</dt>
    <dd>Rounding mode to round away from zero.</dd>

    <dt>Intl.NumberFormat.ROUND_HALF_DOWN</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.</dd>

    <dt>Intl.NumberFormat.ROUND_HALF_EVEN</dt>
    <dd>Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.</dd>
    <dt>Intl.NumberFormat.ROUND_HALF_CEILING</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards positive infinity.</dd>

    <dt>Intl.NumberFormat.ROUND_HALF_UP</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.</dd>

    <dt>Intl.NumberFormat.ROUND_HALF_EVEN</dt>
    <dd>Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.</dd>

    <dt>Intl.NumberFormat.ROUND_HALF_FLOOR</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards negative infinity.</dd>

    <dt>Intl.NumberFormat.ROUND_HALF_DOWN</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.</dd>
    </dl>
  13. steveluscher revised this gist Feb 23, 2015. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -52,24 +52,24 @@ console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximum
    <a name="roundingmodes"></a>
    #### Rounding modes
    <dl>
    <dt>CEILING</dt>
    <dt>Intl.NumberFormat.ROUND_CEILING</dt>
    <dd>Rounding mode to round towards positive infinity.</dd>

    <dt>FLOOR</dt>
    <dt>Intl.NumberFormat.ROUND_FLOOR</dt>
    <dd>Rounding mode to round towards negative infinity.</dd>

    <dt>DOWN</dt>
    <dt>Intl.NumberFormat.ROUND_DOWN</dt>
    <dd>Rounding mode to round towards zero.</dd>

    <dt>UP</dt>
    <dt>Intl.NumberFormat.ROUND_UP</dt>
    <dd>Rounding mode to round away from zero.</dd>

    <dt>HALF_DOWN</dt>
    <dt>Intl.NumberFormat.ROUND_HALF_DOWN</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.</dd>

    <dt>HALF_EVEN</dt>
    <dt>Intl.NumberFormat.ROUND_HALF_EVEN</dt>
    <dd>Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.</dd>

    <dt>HALF_UP</dt>
    <dt>Intl.NumberFormat.ROUND_HALF_UP</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.</dd>
    </dl>
  14. steveluscher revised this gist Feb 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -42,9 +42,9 @@ var number = 1234567.89;

    // abbreviate a number
    console.log(new Intl.NumberFormat('en-US', { abbreviationThreshold: 1e5, maximumSignificantDigits: 3 }).format(number));
    console.log(new Intl.NumberFormat('en-US', { abbreviationThreshold: 1e6, maximumSignificantDigits: 3 }).format(number));
    // → 1.23M
    console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e5, maximumSignificantDigits: 3 }).format(number));
    console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e6, maximumSignificantDigits: 3 }).format(number));
    // → 123万
    ```
  15. steveluscher revised this gist Feb 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ## Syntax

    ```
    ```javascript
    new Intl.NumberFormat([locales[, options]])
    Intl.NumberFormat.call(this[, locales[, options]])
    ```
  16. steveluscher revised this gist Feb 23, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ Intl.NumberFormat.call(this[, locales[, options]])

    The results can be customized using the options argument:

    ```
    ```javascript
    var number = 1234567.89;

    @@ -47,6 +47,7 @@ console.log(new Intl.NumberFormat('en-US', { abbreviationThreshold: 1e5, maximum
    console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e5, maximumSignificantDigits: 3 }).format(number));
    // → 123万
    ```

    <a name="roundingmodes"></a>
    #### Rounding modes
  17. steveluscher revised this gist Feb 23, 2015. 1 changed file with 21 additions and 2 deletions.
    23 changes: 21 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -18,17 +18,36 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dl>
    <dt>abbreviationThreshold</dt>
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. The default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. Possible values are from <code>0</code> to <code>Infinity</code>; the default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>; the default is <mark>???</mark>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    </dl>
    </dd>
    </dl>


    ## Examples


    ### Example: Using `options`

    The results can be customized using the options argument:

    ```
    var number = 1234567.89;
    // abbreviate a number
    console.log(new Intl.NumberFormat('en-US', { abbreviationThreshold: 1e5, maximumSignificantDigits: 3 }).format(number));
    // → 1.23M
    console.log(new Intl.NumberFormat('ja-JP', { abbreviationThreshold: 1e5, maximumSignificantDigits: 3 }).format(number));
    // → 123万
    <a name="roundingmodes"></a>
    #### Rounding modes
    <dl>
  18. steveluscher revised this gist Feb 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. The default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>. For more information about rounding modes, see <a href="#roundingmodes">LINK</a>.</dd>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>. For more information about rounding modes, see <a href="#roundingmodes">rounding modes</a>.</dd>
    </dl>
    </dd>
  19. steveluscher revised this gist Feb 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -17,10 +17,10 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <p>Optional. An object with some or all of the following properties:</p>
    <dl>
    <dt>abbreviateThreshold</dt>
    <dt>abbreviationThreshold</dt>
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. The default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviateRoundingMethod</dt>
    <dt>abbreviationRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>. For more information about rounding modes, see <a href="#roundingmodes">LINK</a>.</dd>
    </dl>
  20. steveluscher revised this gist Feb 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ Intl.NumberFormat.call(this[, locales[, options]])
    <dl>
    <dt>abbreviateThreshold</dt>
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. The default is <code>Infinity</code>.</dd>
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. The default is <code>Infinity</code>, which effectively disables abbreviation.</dd>
    <dt>abbreviateRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>. For more information about rounding modes, see <a href="#roundingmodes">LINK</a>.</dd>
  21. steveluscher created this gist Feb 23, 2015.
    55 changes: 55 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    # Intl.NumberFormat

    ## Syntax

    ```
    new Intl.NumberFormat([locales[, options]])
    Intl.NumberFormat.call(this[, locales[, options]])
    ```

    ### Parameters


    <dl>
    <dt>options</dt>
    <dd>
    <p>Optional. An object with some or all of the following properties:</p>
    <dl>
    <dt>abbreviateThreshold</dt>
    <dd>Numbers whose absolute value is greater than this number will be abbreviated. The default is <code>Infinity</code>.</dd>
    <dt>abbreviateRoundingMethod</dt>
    <dd>The rounding behavior to exhibit when abbreviating a number. Possible values are <code>Intl.NumberFormat.ROUND_CEILING</code>, <code>Intl.NumberFormat.ROUND_FLOOR</code>, <code>Intl.NumberFormat.ROUND_UP</code>, <code>Intl.NumberFormat.ROUND_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_DOWN</code>, <code>Intl.NumberFormat.ROUND_HALF_EVEN</code>, and <code>Intl.NumberFormat.ROUND_HALF_UP</code>. For more information about rounding modes, see <a href="#roundingmodes">LINK</a>.</dd>
    </dl>
    </dd>
    </dl>


    <a name="roundingmodes"></a>
    #### Rounding modes
    <dl>
    <dt>CEILING</dt>
    <dd>Rounding mode to round towards positive infinity.</dd>

    <dt>FLOOR</dt>
    <dd>Rounding mode to round towards negative infinity.</dd>

    <dt>DOWN</dt>
    <dd>Rounding mode to round towards zero.</dd>

    <dt>UP</dt>
    <dd>Rounding mode to round away from zero.</dd>

    <dt>HALF_DOWN</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.</dd>

    <dt>HALF_EVEN</dt>
    <dd>Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.</dd>

    <dt>HALF_UP</dt>
    <dd>Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.</dd>
    </dl>