Difference between revisions 5873112 and 5873113 on simplewiki

{{Documentation subpage}}
{{lua|Module:Math}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->
==Usage==
This template rounds parameter 1 by parameter 2 decimal places (goes the other way for negative rounding) and includes trailing zeros.
::: {{<code>'''rnd'''|54.376|2</code>}} &nbsp; &nbsp; gives {{rnd|54.376|2}}
(contracted; show full)

The [[Lua script|Lua]]-based version of <nowiki>{{rnd}}</nowiki> uses [[Module:Math]] and always has an expansion depth of 3. However, the markup-based version has an expansion depth of 9–15, which depends on the size of the numbers (integer results use depth 9, decimals use depth 12), where astronomical numbers can hit expansion depth of 15 levels, for <nowiki>{{rnd|56.44e33|-32}}</nowiki>&nbsp;&rarr; 5.64&nbsp;× 10<sup>34</sup>.

===
  TemplateData===
{{TemplateDataHeader}}
<templatedata>{
"description": "Rounds (parameter 1) by (parameter 2) decimal places, and formats. Scientific notation is used for numbers greater than 1×10^9, or less than 1×10^−4.",
"params": {
  "1": {
    "label": "number",
    "description": "The number to be rounded",
    "type": "number",
    "required": true
  },
  "2": {
    "label": "decimal places",
    "description": "The number of decimal places, if negative the number is rounded so the last (parameter 2) digits are zero",
    "type": "number",
    "required": true
  }
}}</templatedata>


==See also==
*{{tl|rndfrac}}
*{{tl|rndnear}}
*{{tl|rndgaps}}

<includeonly><!--
++++ PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, THANK YOU. -->
{{DEFAULTSORT:{{PAGENAME}}}}
[[Category:Mathematical function templates]]

</includeonly>