Template:Rndgaps
Usage
eeditLike {{rnd}}, this template rounds {{{1}}} to {{{2}}} decimal places (goes the other way for negatives) and includes trailing zeros. Also like {{rnd}}, scientific notation is used for numbers whose absolute value is greater than or equal to 1×109, or less than 1×10−4. It differs from {{rnd}} in that it uses thin gaps to delimit numbers like {{val}} (see also {{gaps}}).
Examples:
{{rndgaps|2.0004|3}}
→ 2.000{{rndgaps|0.000020004|7}}
→ 2.00×10−5{{rndgaps|0|8}}
→ 0.00000000{{rndgaps|154268|-3}}
→ 154000{{rndgaps|1200004|-1}}
→ 1200000{{rndgaps|1300004|-1}}
→ 1300000{{rndgaps|4.1e6|9}}
→ 4099999.9990000{{rndgaps|4.1e6|10}}
→ 4099999.9990000{{rndgaps|1542689271|-7}}
→ 1.54×109{{rndgaps|1542689271|2}}
→ 1.54268927100×109{{rndgaps|7e9|-9}}
→ 7×109{{rndgaps|-123|1}}
→ −123.0{{rndgaps|-1200007|-2}}
→ −1200000{{rndgaps|-1234567899|-7}}
→ −1.23×109
As with #expr, the total number of significant digits is not more than 14:
{{rndgaps|1234567890.123456789|10}}
→ 1.2345678901235×109{{rndgaps|123456789.0123456789|10}}
→ 123456789.01235{{rndgaps|.0001234567890123456789|20}}
→ 0.00012345678901235
Internal details
eeditThe template uses the following.
- {{val/delimitnum/fraction}} — for trailing zeros
- {{rndgaps/e+}} — for scientific notation for numbers greater than or equal to 109 or less than or equal to −109
- {{rndgaps/e−}} — for scientific notation for numbers greater than −10−4 and less than 10−4 but not equal to zero