Template:Decimals

This is the current revision of this page, as edited by Alex (talk | contribs) at 00:23, 17 October 2024 (Created page with "<includeonly>{{#ifexpr: {{{2}}}<=0 | {{#expr:{{{1}}} round {{{2}}}}} | {{#expr:{{{1}}} round {{#ifexpr: {{{2}}}>12|12|{{{2}}}}}}} {{#ifexpr: ({{{2}}}>=1) and (({{{1}}} round 0)=({{{1}}} round {{{2}}})) |.0|}} {{#ifexpr: ({{{2}}}>=2) and (({{{1}}} round 1)=({{{1}}} round {{{2}}})) |0|}} {{#ifexpr: ({{{2}}}>=3) and (({{{1}}} round 2)=({{{1}}} round {{{2}}})) |0|}} {{#ifexpr: ({{{2}}}>=4) and (({{{1}}} round 3)=({{{1}}} round {{{2}}})) |0|}} {{#ifexpr: ({{{2}}}>=5) and (({{..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Template documentation
This documentation is transcluded from Template:Decimals/doc. [edit] [history] [purge]

The Decimals template is used to format a number, up to 5 decimals.

Usage

{{decimals|number|decimals}}

Note: The maximum number for decimals is limited to 5, but this value can be increased if required.

Examples

.0

.0 0


0 0

  • {{decimals|1/3|5}} yields 0.33333 (only the first 5 digits are returned)
  • {{decimals|22/7|5}} yields 3.14286 (only the first 5 digits are returned)
  • {{decimals|1/33|5}} yields 0.0303



0

.0