Difference between revisions 5873108 and 5873109 on simplewiki

{{Documentation subpage}}
<!-- 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}}
::: {{<code>'''rnd'''|54.376|-1</code>}} &nbsp; gives {{rnd|54.376|-1}}
(contracted; show full)

==Internal details==
The markup-based version of Template:rnd uses three subtemplates:
*{{tl|rnd/-}} — for trailing zeros
*{{tl|rnd/e+}} — for scientific notation for numbers greater than or equal to 10<sup>9</sup> or less than or equal to −10<sup>9</sup>
*{{tl|rnd/e−}} — for scientific notation for numbers greater than −10<sup>−4</sup> and less than 10<sup>−4</sup> but not equal to zero

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>.

==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]]
[[Category:Lua-based templates]]

[[ar:Template:Rnd]]
[[bn:টেমপ্লেট:Rnd/doc]]
[[id:Templat:Rnd]]
[[os:Шаблон:Rnd]]
[[ja:Template:Rnd]]
[[tpi:Template:Rnd]]
[[pt:Predefinição:Rnd]]
[[sl:Predloga:Rnd]]
[[sr:Шаблон:Rnd]]
[[zh:Template:Rnd]]
</includeonly>