Difference between revisions of "Template:Coord/prec dec"

From blackwiki
Jump to navigation Jump to search
imported>Quarl
imported>Quarl
(new implementation to fix some bugs)
Line 1: Line 1:
<includeonly>{{#ifexpr:{{{1}}} round 1 = {{{1}}} round 0 and {{{2}}} round 1 = {{{2}}} round 0|d|{{#ifexpr:{{{1}}}*100 round 1 = {{{1}}}*100 round 0 and {{{2}}}*100 round 1 = {{{2}}}*100 round 0|dm|dms}}}}</includeonly><noinclude>{{template doc}}</noinclude>
+
<includeonly>{{#switch:{{max|{{precision2|{{{1}}}}}|{{precision2|{{{2}}}}}|0=d|1|2=dm|dms}}</includeonly><noinclude>{{template doc}}</noinclude>

Revision as of 21:44, 18 April 2007

Template documentation[view] [edit] [history] [purge]

This template, {{Coord/prec dec}}, returns "d", "dm", or "dms" to indicate the most appropriate display format for a latitude-longitude pair expressed in decimal degrees.

Usage

{{Coord/prec dec|lat|long}}

Examples

{{Coord/prec dec|99|1}} {{#switch:1
{{Coord/prec dec|99|1.2}} {{#switch:1
{{Coord/prec dec|99|1.23}} {{#switch:1
{{Coord/prec dec|99|1.234}} {{#switch:1
{{Coord/prec dec|99|1.2345}} {{#switch:1
{{Coord/prec dec|99|1.23456}} {{#switch:1
{{Coord/prec dec|99|1.0}} {{#switch:1
{{Coord/prec dec|99|1.00}} {{#switch:1
{{Coord/prec dec|99|1.000}} {{#switch:1
{{Coord/prec dec|99|1.0000}} {{#switch:1
{{Coord/prec dec|99|1.00000}} {{#switch:1