Шаблон:Шанс/док
A standardized way of probability presentation.
Usage
{{ chance | <fraction> | <digit to round to> (optional) | pad = y/yes (optional) | reduce = n/no (optional) | mode = f/p (optional) }}
- First unnamed parameter
The fraction of chance. e.g. 1/250
, 4/100
. It does not need to be an irreducible fraction, the template will reduce it if needed.
- Second unnamed parameter
Rounds off the percent number to a multiple of 1/10 raised to a power, with the exponent equal to this number. Default value is 2
.
- pad
If set, when the actual number of digits is less than the given value specified by the second unnamed parameter, it will pad the percent number with zeros to that length.
- reduce
Prevents automatic reduction of the fraction.
- mode
If set to f, only output fractal part; if set to p, only output percent part.
Example
Code | Result |
---|---|
{{chance|1/100}} |
1/100 (1%) ПОМИЛКА! (очікується: |
{{chance|1 in 100}} |
1/100 (1%) ПОМИЛКА! (очікується: |
{{chance|1 in 1,000}} |
1/1000 (0,1%) ПОМИЛКА! (очікується: |
{{chance|1/2500}} |
1/2500 (0,04%) ПОМИЛКА! (очікується: |
{{chance|1/100|pad=y}} |
1/100 (1,00%) ПОМИЛКА! (очікується: |
{{chance|1/2500|4|pad=y}} |
1/2500 (0,0400%) ПОМИЛКА! (очікується: |
{{chance|1/7}} |
1/7 (14,29%) ПОМИЛКА! (очікується: |
{{chance|1/7|4}} |
1/7 (14,2857%) ПОМИЛКА! (очікується: |
{{chance|84/1000}} |
21/250 (8,4%) ПОМИЛКА! (очікується: |
{{chance|84/1000|reduce=n}} |
84/1000 (8,4%) ПОМИЛКА! (очікується: |
{{chance|49/11250}} |
49/11250 (0,44%) ПОМИЛКА! (очікується: |
{{chance|1/2500|mode=f}} |
1/2500 ПОМИЛКА! (очікується: |
{{chance|1/2500|mode=p}} |
0,04% ПОМИЛКА! (очікується: |
Options
Цей шаблон підтримує параметри через шаблон {{options}}. Нижче наведено всі дійсні параметри. Щодо використання та іншої інформації перегляньте {{options}}.
Дивіться Template:шанс/initOptions, щодо налаштування параметрів цього шаблону.
Назва | Інша назва | Значення за замовчуванням | Заміна значень[1] | Примітка |
---|
- ↑ Значення із заміною будуть збережені та завантажені як замінені значення. Інші значення без замін будуть збережені та завантажені як є.
Example:
A: {{chance|84/1000}} {{options/set|chance|precision=4|pad=y|reduce=n}} B: {{chance|84/1000}} {{options/reset|chance}}
It will output:
A: 21/250 (8,4%)
B: 84/1000 (8,4000%)