Jump to content

Template:One In X: Difference between revisions

From RiskiPedia
User-friendly display of a fractional risk
 
Switch to Module:ProbabilityFormat
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
This is the "One in X" template. It uses the Parser Function extension functions to convert a floating point number into a user-friendly "x in ten / hundred / thousand / etc"
This is the "One in X" template. It uses Module:ProbabilityFormat to convert a decimal probability into a more human-friendly "1 in X" string.
</noinclude><includeonly>{{#ifexpr: {{{1}}} < 1e-6 | less than one in a million |
</noinclude><includeonly>{{#invoke:ProbabilityFormat|convert|{{{1}}}}}</includeonly>
  {{#ifexpr: {{{1}}} < 1e-3 | {{#expr: {{{1}}}*1e6 round 0}} in a million |
  {{#ifexpr: {{{1}}} < 1e-2 | {{#expr: {{{1}}}*1e3 round 0}} in a thousand |
  {{#ifexpr: {{{1}}} < 1e-1 | {{#expr: {{{1}}}*1e2 round 0}} in a hundred |
  {{#ifexpr: {{{1}}} < 1 | {{#expr: {{{1}}}*100 round 0}} percent |
  100 percent (absolutely certain) }} }} }} }} }}</includeonly>

Latest revision as of 21:57, 2 September 2025

This is the "One in X" template. It uses Module:ProbabilityFormat to convert a decimal probability into a more human-friendly "1 in X" string.