GuildWiki

GuildWiki has been locked down: anonymous editing and account creation are disabled. Current registered users are unaffected. Leave any comments on the Community Portal.

READ MORE

GuildWiki
(Created page with '{{#ifexpr:({{{current|0}}}-{{{min|0}}}>=0) and ({{{max|100}}}-{{{min|0}}}>0)|{{#expr:(({{{current|0}}}-{{{min|0}}})/({{{max|100}}}-{{{min|0}}}))*100 round 1}}%|0%}}} ==Usa…')
 
 
Line 1: Line 1:
{{#ifexpr:({{{current|0}}}-{{{min|0}}}>=0) and ({{{max|100}}}-{{{min|0}}}>0)|{{#expr:(({{{current|0}}}-{{{min|0}}})/({{{max|100}}}-{{{min|0}}}))*100 round 1}}%|0%}}}
+
<onlyinclude>{{#ifexpr:({{{2|0}}}>={{{3|100}}})|100|{{#ifexpr:({{{2|0}}}<{{{1|0}}})|0| {{#expr:(({{{2|0}}}-{{{1|0}}})/({{{3|100}}}-{{{1|0}}}))*100 round 1}}}}}}</onlyinclude>
   
 
==Usage==
 
==Usage==
;<nowiki>{{</nowiki>progress %|''min''|''current''|''max''}}:Computes the percentage (current-min)/(max-min), limited to 0%-100%. Ideally, min <= current <= max.
+
;<nowiki>{{</nowiki>progress %|''min''|''current''|''max''}}:Computes the percentage (current-min)/(max-min), limited to 0-100. Ideally, min <= current <= max.
* The percentage is 100% for current > max.
+
* The percentage is 100 for current >= max.
* The percentags is 0 for current < min, if min < max.
+
* The percentage is 0 for current < min, if min < max.
  +
* The result is a whole number from 0 to 100; no % sign is returned.
  +
  +
Technical note: There is no test for division by zero, because ''min <= current < max'' implies ''min < max''.
   
 
[[Category:Templates/maths]]
 
[[Category:Templates/maths]]

Latest revision as of 09:28, 22 July 2010

0

Usage

{{progress %|min|current|max}}
Computes the percentage (current-min)/(max-min), limited to 0-100. Ideally, min <= current <= max.
  • The percentage is 100 for current >= max.
  • The percentage is 0 for current < min, if min < max.
  • The result is a whole number from 0 to 100; no % sign is returned.

Technical note: There is no test for division by zero, because min <= current < max implies min < max.