Template:Frac: Difference between revisions
From Vigyanwiki
Template>Arthur Rubin (Remove use of "1/" character; {{Fraction|1|x}} should produce the same result as {{Fraction|x}}) |
Template>Crissov (neglectable speed improvement, use ‘⅟’ whenever numerator is 1) |
||
Line 1: | Line 1: | ||
<span class=" | <span class="frac">{{#if:{{{3|}}} | ||
|{{{1}}} {{#switch:{{{3}}} | |{{{1}}} {{#switch:{{{3}}} | ||
|2 = {{#ifeq:{{{2}}}|1 | |2 = {{#ifeq:{{{2}}}|1 | ||
|½ | |½ | ||
|{{{2}}} | |{{{2}}}⁄2 | ||
}} | }} | ||
|3 = {{#switch:{{{2}}} | |3 = {{#switch:{{{2}}} | ||
|1=⅓ | |1=⅓ | ||
|2=⅔ | |2=⅔ | ||
|#default={{{2}}} | |#default={{{2}}}⁄3 | ||
}} | }} | ||
|4 = {{#switch:{{{2}}} | |4 = {{#switch:{{{2}}} | ||
Line 15: | Line 14: | ||
|2=½ | |2=½ | ||
|3=¾ | |3=¾ | ||
|#default={{{2}}} | |#default={{{2}}}⁄4 | ||
}} | }} | ||
|5 = {{#switch:{{{2}}} | |5 = {{#switch:{{{2}}} | ||
Line 22: | Line 21: | ||
|3=⅗ | |3=⅗ | ||
|4=⅘ | |4=⅘ | ||
|#default={{{2}}} | |#default={{{2}}}⁄5 | ||
}} | }} | ||
|6 = {{#switch:{{{2}}} | |6 = {{#switch:{{{2}}} | ||
Line 30: | Line 29: | ||
|4=⅔ | |4=⅔ | ||
|5=⅚ | |5=⅚ | ||
|#default={{{2}}} | |#default={{{2}}}⁄6 | ||
}} | }} | ||
|8 = {{#switch:{{{2}}} | |8 = {{#switch:{{{2}}} | ||
Line 40: | Line 39: | ||
|6=¾ | |6=¾ | ||
|7=⅞ | |7=⅞ | ||
|#default={{{2}}} | |#default={{{2}}}⁄8 | ||
}} | }} | ||
|#default={{{2}}}⁄{{{3}}} | |#default={{#ifeq:{{{2}}}|1|⅟|{{{2}}}⁄}}{{{3}}} | ||
}} | }} | ||
|{{#if:{{{2|}}} | |{{#if:{{{2|}}} | ||
Line 48: | Line 47: | ||
|2 = {{#ifeq:{{{1}}}|1 | |2 = {{#ifeq:{{{1}}}|1 | ||
|½ | |½ | ||
|{{{1}}} | |{{{1}}}⁄2 | ||
}} | }} | ||
|3 = {{#switch:{{{1}}} | |3 = {{#switch:{{{1}}} | ||
|1=⅓ | |1=⅓ | ||
|2=⅔ | |2=⅔ | ||
|#default={{{1}}} | |#default={{{1}}}⁄3 | ||
}} | }} | ||
|4 = {{#switch:{{{1}}} | |4 = {{#switch:{{{1}}} | ||
Line 59: | Line 58: | ||
|2=½ | |2=½ | ||
|3=¾ | |3=¾ | ||
|#default={{{1}}} | |#default={{{1}}}⁄4 | ||
}} | }} | ||
|5 = {{#switch:{{{1}}} | |5 = {{#switch:{{{1}}} | ||
Line 66: | Line 65: | ||
|3=⅗ | |3=⅗ | ||
|4=⅘ | |4=⅘ | ||
|#default={{{1}}} | |#default={{{1}}}⁄5 | ||
}} | }} | ||
|6 = {{#switch:{{{1}}} | |6 = {{#switch:{{{1}}} | ||
Line 74: | Line 73: | ||
|4=⅔ | |4=⅔ | ||
|5=⅚ | |5=⅚ | ||
|#default={{{1}}} | |#default={{{1}}}⁄6 | ||
}} | }} | ||
|8 = {{#switch:{{{1}}} | |8 = {{#switch:{{{1}}} | ||
Line 84: | Line 83: | ||
|6=¾ | |6=¾ | ||
|7=⅞ | |7=⅞ | ||
|#default={{{1}}} | |#default={{{1}}}⁄8 | ||
}} | }} | ||
|#default={{{1}}}⁄{{{2}}} | |#default={{#ifeq:{{{1}}}|1|⅟|{{{1}}}⁄}}{{{2}}} | ||
}} | }} | ||
|{{#switch:{{{1}}} | |{{#switch:{{{1}}} | ||
Line 95: | Line 94: | ||
|6=⅙ | |6=⅙ | ||
|8=⅛ | |8=⅛ | ||
|#default= | |#default=⅟{{{1|x}}} | ||
}} | }} | ||
}} | }} |
Revision as of 12:29, 12 December 2011
⅟x
Template documentation
[create]