Difference between revisions of "Template:Fraction"

From blackwiki
Jump to navigation Jump to search
imported>Crissov
(3/9, 6/9; no ⅟ anymore)
imported>Crissov
(simpler code that should yield identical results)
Line 1: Line 1:
<span class="frac nowrap">{{#if:{{{3|}}}
+
<span class="frac nowrap">{{#if:{{{3|{{{2|}}}}}}
|{{{1}}}&thinsp;{{#switch:{{{3}}}
+
|{{#if: {{{3|}}} |{{{1}}}&thinsp;|}}{{#switch:
  |2 = {{#ifeq:{{{2}}}|1
+
  {{#expr: {{#if: {{{3|}}} | {{{2}}}/{{{3}}} | {{{1}}}/{{{2}}} }} }}
        |½
+
   |{{#expr:1/2}} = ½
        |{{{2}}}⁄2
+
   |{{#expr:1/3}} = ⅓
      }}
+
   |{{#expr:2/3}} = ⅔
  |3 = {{#switch:{{{2}}}
+
  |{{#expr:1/4}} = ¼
        |1=⅓
+
   |{{#expr:3/4}} = ¾
        |2=⅔
+
  |{{#expr:1/5}} = ⅕
        |#default={{{2}}}⁄3
+
  |{{#expr:2/5}} = ⅖
      }}
+
   |{{#expr:3/5}} = ⅗
  |4 = {{#switch:{{{2}}}
+
  |{{#expr:4/5}} = ⅘
        |1=¼
+
   |{{#expr:1/6}} =
        |2=½
+
  |{{#expr:5/6}} = ⅚
        |3=¾
+
   |{{#expr:1/8}} =
        |#default={{{2}}}⁄4
+
  |{{#expr:3/8}} = ⅜
      }}
+
   |{{#expr:5/8}} =
  |5 = {{#switch:{{{2}}}
+
   |{{#expr:7/8}} =
        |1=⅕
+
  |#default={{#if:{{{3|}}} | {{{2}}}{{{3}}} | {{{1}}}⁄{{{2}}} }}
        |2=⅖
 
        |3=⅗
 
        |4=⅘
 
        |#default={{{2}}}⁄5
 
      }}
 
   |6 = {{#switch:{{{2}}}
 
        |1=⅙
 
        |2=⅓
 
        |3
 
        |4=⅔
 
        |5=⅚
 
        |#default={{{2}}}⁄6
 
      }}
 
   |8 = {{#switch:{{{2}}}
 
        |1=⅛
 
        |2=¼
 
        |3=⅜
 
        |4=½
 
        |5=⅝
 
        |6=¾
 
        |7=⅞
 
        |#default={{{2}}}⁄8
 
      }}
 
   |9 = {{#switch:{{{2}}}
 
        |3=⅓
 
        |6=⅔
 
        |#default={{{2}}}⁄9
 
      }}
 
   |#default={{{2}}}⁄{{{3}}}
 
}}
 
|{{#if:{{{2|}}}
 
|{{#switch:{{{2}}}
 
   |2 = {{#ifeq:{{{1}}}|1
 
        |½
 
        |{{{1}}}⁄2
 
      }}
 
   |3 = {{#switch:{{{1}}}
 
        |1=
 
        |2=⅔
 
        |#default={{{1}}}⁄3
 
      }}
 
   |4 = {{#switch:{{{1}}}
 
        |1=¼
 
        |2=½
 
        |3=¾
 
        |#default={{{1}}}⁄4
 
      }}
 
   |5 = {{#switch:{{{1}}}
 
        |1=
 
        |2=⅖
 
        |3=⅗
 
        |4=⅘
 
        |#default={{{1}}}⁄5
 
      }}
 
   |6 = {{#switch:{{{1}}}
 
        |1=
 
        |2=⅓
 
        |3=½
 
        |4=⅔
 
        |5=⅚
 
        |#default={{{1}}}⁄6
 
      }}
 
  |8 = {{#switch:{{{1}}}
 
        |1=⅛
 
        |2=¼
 
        |3=⅜
 
        |4=½
 
        |5=⅝
 
        |6=¾
 
        |7=⅞
 
        |#default={{{1}}}⁄8
 
      }}
 
  |9 = {{#switch:{{{1}}}
 
        |3=⅓
 
        |6=⅔
 
        |#default={{{1}}}⁄9
 
      }}
 
  |#default={{{1}}}⁄{{{2}}}
 
 
  }}
 
  }}
 
|{{#switch:{{{1}}}
 
|{{#switch:{{{1}}}
Line 106: Line 28:
 
   |#default=1⁄{{{1|x}}}
 
   |#default=1⁄{{{1|x}}}
 
  }}
 
  }}
}}
 
 
}}</span><noinclude>
 
}}</span><noinclude>
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 23:10, 27 November 2012

1⁄x

Template documentation[create]