The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
{{documentation subpage}} | {{documentation subpage}} | ||
'''{{tl|convert}}''' calculates a measurement value (''number × unit'') into the same measurement by a different unit, and then presents the results, formatted. See also the [[w:Module:Convert/documentation/conversion data|unit symbols recognized by this template]]. | '''{{tl|convert}}''' calculates a measurement value (''number × unit'') into the same measurement by a different unit, and then presents the results, formatted. See also the [[w:Module:Convert/documentation/conversion data|unit symbols recognized by this template]]. | ||
Line 126: | Line 124: | ||
===<span id="Round to a multiple of a given fraction"></span>Round to a multiple of a given fraction: ''{{frac|2|3|16}} inch''=== | ===<span id="Round to a multiple of a given fraction"></span>Round to a multiple of a given fraction: ''{{frac|2|3|16}} inch''=== | ||
Specify the desired ''denominator'' using {{para|frac|<some positive integer>}}. ([[ | Specify the desired ''denominator'' using {{para|frac|<some positive integer>}}. ([[Fraction (mathematics)|Denominator]] is the below-the-slash number, for example the 3 in {{frac|1|3}}). | ||
* <code><nowiki>{{convert|5.56|cm|in|frac=16}}</nowiki></code> → {{convert|5.56|cm|in|frac=16}} | * <code><nowiki>{{convert|5.56|cm|in|frac=16}}</nowiki></code> → {{convert|5.56|cm|in|frac=16}} | ||
* <code><nowiki>{{convert|8|cm|in|frac=4}}</nowiki></code> → {{convert|8|cm|in|frac=4}} | * <code><nowiki>{{convert|8|cm|in|frac=4}}</nowiki></code> → {{convert|8|cm|in|frac=4}} | ||
Line 176: | Line 174: | ||
See also: | See also: | ||
* For multiple-unit options like ''1 ft 5 in'', see | * For multiple-unit options like ''1 ft 5 in'', see {{section link||In input}} and {{section link||In output}}. | ||
==Ranges of values== | ==Ranges of values== | ||
{{ | {{For|a conversion of a difference|#Units of difference}} | ||
A ''range'' converts ''two'' values and separates them by your choice of words and punctuation. | A ''range'' converts ''two'' values and separates them by your choice of words and punctuation. | ||
Line 286: | Line 284: | ||
| <code><nowiki>{{convert|3|x|6|ft|abbr=on}}</nowiki></code> | | <code><nowiki>{{convert|3|x|6|ft|abbr=on}}</nowiki></code> | ||
| {{convert|3|x|6|ft|abbr=on}} | | {{convert|3|x|6|ft|abbr=on}} | ||
|- class="sortbottom"<!--deprecated--> | |||
| <code>xx</code> | |||
| colspan=3 | {{!mxt|1=|xx|}} is '''deprecated'''. Use {{mxt|1=|x|}} instead | |||
|- class="sortbottom"<!--deprecated--> | |||
| <code>*</code> | |||
| colspan=3 | {{!mxt|1=|*|}} is '''deprecated'''. Use {{mxt|1=|x|}} instead | |||
|} | |} | ||
Line 343: | Line 347: | ||
===Wrapping and line breaking=== | ===Wrapping and line breaking=== | ||
:See | :See {{section link|Help:Convert|Wrapping and line breaking}} | ||
===<span id="million"></span>Spelling out "thousands", "millions", etc.=== | ===<span id="million"></span>Spelling out "thousands", "millions", etc.=== | ||
Line 505: | Line 509: | ||
===Scientific notation: ''1.23 × 10<sup>−14</sup>''=== | ===Scientific notation: ''1.23 × 10<sup>−14</sup>''=== | ||
In [[ | In [[scientific notation]], a number is written like {{val|1.23e-14}}. The plain number has exactly one digit before the decimal point. | ||
With {{tlf|convert}}, the input can be in e-notation such as <code>12.3e4</code>. This value is displayed as a power of ten, and the output is displayed in scientific notation, except that an output value satisfying 0.01 <= v < 1000 is shown as a normal number. In addition, if the output value is 1000 and sigfig=4 is used, the value is displayed as a normal number. | With {{tlf|convert}}, the input can be in e-notation such as <code>12.3e4</code>. This value is displayed as a power of ten, and the output is displayed in scientific notation, except that an output value satisfying 0.01 <= v < 1000 is shown as a normal number. In addition, if the output value is 1000 and sigfig=4 is used, the value is displayed as a normal number. | ||
Line 516: | Line 520: | ||
*<code><nowiki>{{convert|1⁄2|in|mm|1}}</nowiki></code> → {{convert|1⁄2|in|mm|1}} | *<code><nowiki>{{convert|1⁄2|in|mm|1}}</nowiki></code> → {{convert|1⁄2|in|mm|1}} | ||
With positive [[ | With positive [[mixed number]]s (a positive integer and a fraction), use a <code>+</code> sign | ||
*<code><nowiki>{{convert|2+1⁄2|in|mm|1}}</nowiki></code> → {{convert|2+1⁄2|in|mm|1}} | *<code><nowiki>{{convert|2+1⁄2|in|mm|1}}</nowiki></code> → {{convert|2+1⁄2|in|mm|1}} | ||
Line 527: | Line 531: | ||
*<code><nowiki>{{convert|2+½|in|mm|1}}</nowiki></code> → {{convert|2+½|in|mm|1}} {{nay}} Fractions consisting of a single Unicode character are not allowed either. | *<code><nowiki>{{convert|2+½|in|mm|1}}</nowiki></code> → {{convert|2+½|in|mm|1}} {{nay}} Fractions consisting of a single Unicode character are not allowed either. | ||
===Horizontal fraction bar: ''{{ | ===Horizontal fraction bar: ''{{sfrac|1|2}} inch''=== | ||
<!-- technical restriction: TOC does not show the example horizontal bar intended here; rephrased section title--> | <!-- technical restriction: TOC does not show the example horizontal bar intended here; rephrased section title--> | ||
Using a double slash (<code>//</code>) provides a horizontal fraction bar for the original (input) unit: | Using a double slash (<code>//</code>) provides a horizontal fraction bar for the original (input) unit: | ||
Line 668: | Line 672: | ||
==Table options== | ==Table options== | ||
For the [[ | For the [[Help:Table/Manual tables|wikitable]] structure, there are three options: add a line-break, split the result over columns and make the table sortable. | ||
===Enforced line break=== | ===Enforced line break=== | ||
Line 716: | Line 720: | ||
===Sorting=== | ===Sorting=== | ||
Use {{para|sortable|on}} to include a ''hidden numerical sortkey'' in the output, suitable for use in a [[ | Use {{para|sortable|on}} to include a ''hidden numerical sortkey'' in the output, suitable for use in a [[Help:Sorting|table with sortable columns]]. Technically, this places a hidden string before the actual displayed values: | ||
:<code><nowiki>{{convert|10|m|ft|sortable=on}}</nowiki></code> {{nowrap|1=→ <code><span data-sort-value="7001100000000000000♠"></span>10 metres (33 ft)</code>}} | :<code><nowiki>{{convert|10|m|ft|sortable=on}}</nowiki></code> {{nowrap|1=→ <code><span data-sort-value="7001100000000000000♠"></span>10 metres (33 ft)</code>}} | ||
:showing: {{convert|10|m|ft|sortable=on}}. | :showing: {{convert|10|m|ft|sortable=on}}. | ||
Line 729: | Line 733: | ||
|- | |- | ||
| A | | A | ||
| | | {{val|15.75|u=m}} | ||
| {{convert|15+3/4|m|ft|disp=table|sortable=on}} | | {{convert|15+3/4|m|ft|disp=table|sortable=on}} | ||
|- | |- | ||
| B | | B | ||
| | | {{val|15.5|u=m}} | ||
| {{convert|15.5|m|ft|disp=table|sortable=on}} | | {{convert|15.5|m|ft|disp=table|sortable=on}} | ||
|- | |- | ||
| C | | C | ||
| | | {{val|16|u=m}} | ||
| {{convert|16.0|m|ft|disp=table|sortable=on}} | | {{convert|16.0|m|ft|disp=table|sortable=on}} | ||
|- | |- | ||
| D | | D | ||
| | | {{val|16|u=m}} | ||
| {{convert|16|m|ft|disp=table|sortable=on}} | | {{convert|16|m|ft|disp=table|sortable=on}} | ||
|} | |} | ||
Line 748: | Line 752: | ||
==Units== | ==Units== | ||
The conversion factors and physical constants are sourced [[ | The conversion factors and physical constants are sourced [[Module:Convert/documentation/conversion data introduction/doc#Conversion factors and physical constants|here]]. | ||
===All units=== | ===All units=== | ||
See [[ | {{selfref|See also: [[Template:Convert/list of units]]}} | ||
{{hatnote|Units are case-sensitive: use {{xt|kW}}, not {{!xt|KW}} or {{!xt|kw}}}} | |||
{{Convert/list of units}} | |||
==='per' units: ''kg/ha'', ''miles per gallon''<span class="anchor" id="per"></span>=== | ==='per' units: ''kg/ha'', ''miles per gallon''<span class="anchor" id="per"></span>=== | ||
Line 781: | Line 787: | ||
===Multiple units: ''1 ft 5 in''=== | ===Multiple units: ''1 ft 5 in''=== | ||
====In input==== | ====In input==== | ||
Base document | Base document {{section link|Module:Convert/documentation/conversion data/doc|Input multiples|nopage=y}} lists options for ''multiple unit input'' (like <code>ft,in</code>). It can catch predefined sets only (units that can be subdivided; e.g., yd into ft): | ||
* <code><nowiki>{{convert|1|yd|2|ft|3|in}}</nowiki></code> → {{convert|1|yd|2|ft|3|in}} | * <code><nowiki>{{convert|1|yd|2|ft|3|in}}</nowiki></code> → {{convert|1|yd|2|ft|3|in}} | ||
* <code><nowiki>{{convert|2|ft|3|in|cm}}</nowiki></code> → {{convert|2|ft|3|in|cm}} | * <code><nowiki>{{convert|2|ft|3|in|cm}}</nowiki></code> → {{convert|2|ft|3|in|cm}} | ||
Line 787: | Line 793: | ||
====In output==== | ====In output==== | ||
Available multiple-unit output options predefined, like <code>ftin</code> and <code>ydftin</code>. The full list is at | Available multiple-unit output options predefined, like <code>ftin</code> and <code>ydftin</code>. The full list is at {{section link|Module:Convert/documentation/conversion data/doc|Output multiples|nopage=y}}. | ||
* <code><nowiki>{{convert|2|m|ftin}}</nowiki></code> → {{convert|2|m|ftin}} | * <code><nowiki>{{convert|2|m|ftin}}</nowiki></code> → {{convert|2|m|ftin}} | ||
* <code><nowiki>{{convert|2|m|ft in}}</nowiki></code> → {{convert|2|m|ft in}}, using a space, returns the decimal point | * <code><nowiki>{{convert|2|m|ft in}}</nowiki></code> → {{convert|2|m|ft in}}, using a space, returns the decimal point | ||
Line 793: | Line 799: | ||
* <code><nowiki>{{convert|2|m}}</nowiki></code> → {{convert|2|m}} | * <code><nowiki>{{convert|2|m}}</nowiki></code> → {{convert|2|m}} | ||
See also: | |||
* {{tl|hands}} a length used to measure horses | |||
* {{tl|Long ton}} a weight in ton, cwt, qr and lb | |||
<!-- todo: mention the 0-3 limits --> | |||
===Currency per unit: ''$/mi → $/km''=== | ===Currency per unit: ''$/mi → $/km''=== | ||
Line 804: | Line 814: | ||
* <code><nowiki>{{convert|10|$/mi|$/km|$=€}}</nowiki></code> → {{convert|10|$/mi|$/km|$=€}} | * <code><nowiki>{{convert|10|$/mi|$/km|$=€}}</nowiki></code> → {{convert|10|$/mi|$/km|$=€}} | ||
It is ''not'' possible to convert the currency. So, this result (mixed currencies) is ''not'' possible: $15 per mile (€8.6/km)}} {{nay}} | It is ''not'' possible to convert the currency. So, this result (mixed currencies) is ''not'' possible: {{!mxt|1=$15 per mile (€8.6/km)}} {{nay}} | ||
==Using convert inside templates== | |||
For usage in template code, like infoboxes, {{tlf|Convert}} has these options: | |||
;Pre-formatting fraction input | |||
* [[Module:Convert/helper]] can read regular input and pre-format it into {{tlf|Convert}}-accepted input. | |||
:Your template can accept {{para|input|16 7/8}} and use <nowiki>{{#invoke:Convert/helper|number|16 7/8}}</nowiki> → {{#invoke:Convert/helper|number|16 7/8}} | |||
==Parameter list== | ==Parameter list== | ||
{{convert/doc/parameter list}} | |||
==Deprecated options== | |||
{{Convert/doc/deprecations list}} | |||
==TemplateData== | |||
{{TemplateData header}} | |||
<templatedata> | <templatedata> | ||
{ | { | ||
Line 1,322: | Line 1,135: | ||
} | } | ||
</templatedata> | </templatedata> | ||
<!--''to be added'' | |||
==Glossary== | |||
;unit code | |||
: | |||
;unit symbol | |||
: | |||
--> | |||
==See also== | |||
* {{tl|Cvt}} | |||
* {{tl|SI units}} | |||
* {{tl|Inflation}}, for converting historical prices to their current equivalent | |||
* {{tl|To USD}}, for currency conversions | |||
<includeonly> | <includeonly> | ||
[[Category:Templates]] | [[Category:Templates]] | ||
</includeonly> | </includeonly> |