Jump to content

Template:Coord/dec2dms: Difference between revisions

From IdeaWazaWiki
wikademia>Quarl
«"3600" → "60", "3600" → "60"»
wikademia>Quarl
«45 words changed»
Line 1: Line 1:
<includeonly>{{#ifexpr:{{{1}}} >= 0
<includeonly>{{#ifexpr:{{{1}}} >= 0
   |{{#switch:{{{prec}}}
   |{{#switch:{{{prec}}}
     |d={{#expr:{{{1}}} round 0}}°
     |d={{#expr:{{{1}}} mod 360}}°
     |dm={{#expr:{{{1}}} round 0}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′
     |dm={{#expr:{{{1}}} mod 360}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′
     |dms={{#expr:{{{1}}} round 0}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′{{#expr:{{{1}}} * 3600 mod 60 round 1}}″}} {{{2}}}
     |dms={{#expr:{{{1}}} mod 1000000}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′{{#expr:{{{1}}} * 3600 mod 60 round 1}}″}} {{{2}}}
   |{{#switch:{{{prec}}}
   |{{#switch:{{{prec}}}
     |d={{#expr:-{{{1}}} round 0}}°
     |d={{#expr:-{{{1}}} mod 360}}°
     |dm={{#expr:-{{{1}}} round 0}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′
     |dm={{#expr:-{{{1}}} mod 360}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′
     |dms={{#expr:-{{{1}}} round 0}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′{{#expr:-{{{1}}} * 3600 mod 60 round 1}}″}} {{{3}}}}}</includeonly><noinclude>{{template doc}}</noinclude>
     |dms={{#expr:-{{{1}}} mod 360}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′{{#expr:-{{{1}}} * 3600 mod 60 round 1}}″}} {{{3}}}}}</includeonly><noinclude><!--
 
The "mod 360" is necessary to truncate degrees.  "round 0" wouldn't work because it rounds rather than truncates.
 
-->{{template doc}}</noinclude>

Revision as of 05:38, 18 March 2007