Template:InchDec: Difference between revisions

From The Freestyle Knowledge Base
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#vardefine:dec|{{{1}}} }}
<!-- mm = in x 25.4 -->
{{#vardefine:mm|{{#expr: {{#var:dec}}} * 25.4 round 1}} }}
<!--
{{#vardefine:whole|{{#expr: {{#var:dec}} / 1 round 0}} }}
{{#vardefine:whole|{{#expr: {{{1}}} round 0}} }}
{{#vardefine:frac|{{#expr: {{#var:dec}} / 1}} }}
{{#vardefine:float|{{#expr: {{{1}}} - 0{{#var:whole}} }} }}
\frac{1}{4}
{{#var:whole}} 1/{{#expr: 1 / {{#var:float}} round 4}}"
<!-- Output -->
# Attempted to return a fraction as well. Not working.
{{#var:dec}}" ({{#var:mm}} mm)
-->
{{#var:whole}} 1/{{#var:frac}}
{{#vardefine:mm|{{#expr: {{{1}}} * 25.4 round 1}} }}
{{#var:mm}} mm


 
<noinclude>
 
{{Documentation}}
<!--
[[Category:Template]]
 
</noinclude>
7.375" (187.3 mm) 7 3/8"
mm = in x 25.4
-->

Latest revision as of 00:52, 27 March 2016


Expression error: Unrecognized punctuation character "{". mm


Documentation icon Template documentation[view] [edit] [history] [purge]

Usage

This template takes a decimal length value (in inches) as input and displays this same value, plus the fractional and mm (millimetre) equivalents.

Example Output: 7 3/8" (7.375 in, 187.3 mm)

Example Usage

Enter the Decimal value to be displayed.

{{InchDec|7.375}}

Blank template

{{InchDec|}}

Example Output

Input:

{{InchDec|7.375}}

Output:


187.3 mm