Difference between revisions of "Template:Infobox road/meta/length/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>WOSlinker
(add 1 to length when passing to Getprecision to work around bug in Getprecision)
imported>BrownHairedGirl
(remove non-existent Category:Infobox road)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifexpr:{{{length}}}>=1000|{{formatnum:{{{length}}}}}|{{{length}}}}} {{{1}}}{{#if:{{{length_ref|}}}|{{{length_ref}}}|}} ({{rnd|{{#expr:{{{length}}} * {{#ifeq:{{{1}}}|mi|1.609344|0.621371192}}}}|{{#if:{{{round|}}}|{{{round}}}|{{Getprecision|{{#expr:1+{{{length}}}}}}}}}}} {{#ifeq:{{{1}}}|mi|km|mi}})</includeonly>
+
{{#ifexpr:{{{length|567.3}}}>=1000|{{formatnum:{{{length|567.3}}}}}|{{{length|567.3}}}}} {{{1|mi}}}{{#if:{{{length_ref|}}}|{{{length_ref}}}|}} (<!--
 +
-->{{#expr:{{{length|567.3}}} * {{#ifeq:{{{1|mi}}}|mi|1.609344|0.621371192}} round {{#if:{{{round|}}}|{{{round}}}|{{precision|{{{length|567.3}}}|}} }} }} {{#ifeq:{{{1|mi}}}|mi|km|mi}})<noinclude>
 +
 
 +
The '''[[Template:Infobox_road/meta/length]]''' converts miles to [[kilometre]]s, or the reverse, where parameter 1 is "mi" or "km" and the distance is length=567.3 or such.
 +
 
 +
The template rounds the result to the precision of the input decimal digits, where, for example, {&#123;precision|234.65}} is {{precision|234.65}}, for 2 decimal digits. The template expansion depth is 6 levels, of the 41-level limit.
 +
</noinclude>

Latest revision as of 01:42, 5 March 2017

567.3 mi (Expression error: Unrecognized punctuation character "[". km)

The Template:Infobox_road/meta/length converts miles to kilometres, or the reverse, where parameter 1 is "mi" or "km" and the distance is length=567.3 or such.

The template rounds the result to the precision of the input decimal digits, where, for example, {{precision|234.65}} is Template:Precision, for 2 decimal digits. The template expansion depth is 6 levels, of the 41-level limit.