Template:Convert/doc/FAQ

Note: To find topics about Template:Convert, either read each of the dozen questions, below, or search for key phrases used within the page. In some cases, it might be easier to just rapidly scan by "speed reading" all the questions, to get other ideas about using Convert. For a list of all parameter options, see: Template:Convert/doc.

Most common questions

 * Q: When using convert why does the answer not seem right sometimes?
 * A: This template takes into account the precision of the supplied value and generally rounds to the same level of precision. If you need to change from the default output precision, see the "Rounding" section of the template documentation.


 * Q: What are all the possible units (kg, lb, m, cm, ft, in, °C, °F, km, mi, nmi, mph, km/h, and so on)?
 * A: See: Template:Convert/list of units.


 * For more questions, see: Template:Convert/FAQ.

Showing words with conversions

 * Q: Can a conversion say "million" rather than use zeroes "000,000"?
 * A: Yes, there many unit codes with prefixes e3/e6/e9 to show "thousand" or "million" or "billion" units (such as: e6acre, to show "million acres"). Using the "e6acre" (or "e9acre") form will get rid of all the zeroes for converting acres. Some examples:
 * 14 e6acre &rarr; 14 e6acre
 * 14 e6acre &rarr; 14 e6acre
 * 1 e6mi     &rarr; 1 e6mi
 * 2.2 e6mi &rarr; 2.2 e6mi
 * 3.3 e9mi     &rarr; 3.3 e9mi
 * 3.3 e9mi &rarr; 3.3 e9mi
 * Note the output unit code can also use the e3/e6/e9 prefix, but will show x10 notation unless "abbr=off" is set, to show "million" or "billion" in the output amount. Otherwise, using the typical output units would show input "million" but output with zeroes "000".
 * For a list of the other e3/e6/e9 units, see: Template:Convert/list of units.


 * Q: How are customized, extra words shown within a conversion?
 * A: There are 2 options: disp=x, or disp=preunit. Append "disp=x|aaa|bbb" (where "aaa" is the text after the input amount and "bbb" is after the output amount). Use "disp=preunit|aaa|bbb" to insert text prior to each unit. Examples:
 * 9 m     &rarr; 9 m
 * 9 m     &rarr; 9 m
 * 4 m &rarr; 4 m
 * 2 mi &rarr; 2 mi
 * Insert text prior to units, by disp=preunit:
 * 4 m      &rarr; 4 m
 * 4 m &rarr; 4 m
 * When using disp=x, then the parentheses "" are turned off for that conversion, but can be re-added (as "disp=x|deep (|)" for example). However, inserting "or" is common. There is no limit to the total number of words inserted in a conversion. For example:
 * 35 cm      &rarr; 35 cm
 * In many cases, "bbb" can be omitted because the text following a conversion is, essentially, the "bbb" as the continued text of the article. Sometimes, extra words can be inserted just to break the monotony of many conversions in a row: "aa miles (bb km), cc miles (dd km), and eee miles (same as fff km)".


 * Q: How can numbers be spelled-out in words for a conversion?
 * A: Use "{&#123;convert/spell}}" to spell-out the first number or both amounts in words (append "|words=out" to spell both numbers in words). Examples:
 * &rarr;
 * &rarr;
 * &rarr;
 * &rarr;
 * &rarr;
 * In many sentences, a conversion is the first part of the sentence, so using Convert/spell can show the first amount spelled in words. Use "case=u" to up-case the first word, spelling with a capital letter. To show both numbers spelled in words, then specify "words=out" as a parameter. See: Template:Convert/spell for more examples. Use {&#123;spellnum}} to show just 1 number in words, such as {&#123;spellnum|23}} &rarr;.

Changing the format

 * Q: How can we reverse the order of input and output units?
 * A: Using "disp=flip" reverses the order, or flips the units, so that the input unit is displayed in reverse order, as being the output unit. Examples:
 * 23 km     &rarr; 23 km
 * 9 m     &rarr; 9 m
 * 9 m &rarr; 9 m
 * 27 mm &rarr; 27 mm
 * 6 ft &rarr; 6 ft
 * 6 ft &rarr; 6 ft
 * Flipping the units is common when a source document uses metric numbers but the article doesn't, such as a British news source quoting "metres" about an American topic using feet as typical in American English. So, the display is reversed, showing feet first, then the source metres in "".


 * Q: How can we show just the output amount and omit the input?
 * A: Convert allows "disp=out" (or "disp=output only") to show only the output amount/unit, and omit the parentheses "". Examples:
 * 6 ft &rarr; 6 ft
 * 97 km &rarr; 97 km
 * 97 km &rarr; 97 km
 * To show just the number (not the unit), use disp=number (or "disp=output number only"):
 * 6 ft &rarr; 6 ft
 * 97 km &rarr; 97 km
 * The option "abbr=off" can stop the abbreviations and show output with a full unit name, rather than the unit symbol.


 * Q: How can we show just the output unit name (singular/plural) and omit the amount?
 * A: Convert has option "disp=u2" (for unit 2) to show only the output unit name (or unit symbol), and omit the parentheses "" and amount. Examples:
 * 6 ft &rarr; 6 ft
 * 6 ft &rarr; 6 ft
 * 97 km &rarr; 97 km
 * 97 km &rarr; 97 km
 * The option "disp=unit" (shown below) will show the input unit name (or unit symbol), rather than the output unit name.


 * Q: How can we show just the unit name and omit the numbers?
 * A: Convert allows "disp=unit" to show only the unit name or unit symbol. Examples:
 * 6 ft &rarr; 6 ft
 * 1 ft &rarr; 1 ft
 * 4 cuyd &rarr; 4 cuyd
 * 1 km/h &rarr; 1 km/h
 * 1 km2 &rarr; 1 km2
 * The option "disp=unit" is typically used to select either the singular, or plural, name for an amount of a particular unit, but it can also show a formal unit symbol by including "abbr=on" with a unit code.

Performance concerns

 * Q: Convert seems big, but can Convert run faster as used?
 * A: Many articles use fewer than 8 conversions, formatted in one-quarter second (Convert formats 33 conversions per second). Improvements were made to have Convert run in groups of tiny templates. However, setting the precision (or rounding level) can avoid almost half of those templates, such as round by 0, 1 or set sigfig=3 (or similar). In many cases, just round as "|0" or for thousands, use "|-3". Some examples:
 * 9 m     &rarr; 9 m   [ default ]
 * 9 m     &rarr; 9 m   [ round 0 ]
 * 9 m     &rarr; 9 m [ round 1 ]
 * 9000 m     &rarr; 9000 m   [ round 0 ]
 * 9000 m     &rarr; 9000 m   [ round -3 ]
 * 9000 m     &rarr; 9000 m
 * 32 m     &rarr; 32 m [ default ]
 * 32 m     &rarr; 32 m [ round 0 ]
 * 32 m     &rarr; 32 m [ round 1 ]


 * Q: Convert seems to cause some  red error messages, why?
 * A: Invalid unit-codes will show red messages. Also, there are some other large templates which consume resources needed when using Convert inside those templates. A common problem is adding an incorrect plural "s" to a unit, such as "km" pluralized to the incorrect "kms" as follows:
 * 19 km     &rarr; 19 km
 * 19 kms     &rarr; 19 kms
 * There is no "Template:Convert/kms" and unit-code "km" should be used instead, for either 1 or many kilometres.


 * When other large templates consume all the template resources, then several red messages can appear, such as " Page exceeded the expansion depth " as an alert.


 * Other Wikipedia templates might be using many levels of nested logic, leaving fewer for Convert. Convert has been optimized to run in groups of tiny templates. However, setting the precision can avoid several of those nested templates, such as round by 0, 1 or set sigfig=2 (or similar). In many cases, just round as "|0" or for thousands, use "|-3". Some examples:
 * 7 m     &rarr; 7 m   [ round 0 ]
 * 7000 m     &rarr; 7000 m   [ round 0 ]
 * 7000 m     &rarr; 7000 m   [ round -3 ]
 * 7000 m     &rarr; 7000 m
 * Using either rounding by "0" or sigfig=3 (or such) will reduce the nested Convert templates by the same 8-11 nested levels to allow using more templates. However, because Convert can format 15 conversions in a half-second, it is very fast. For numerous conversions, consider hand-coding the results in frequently viewed articles.

Writing new unit subtemplates
&bull; "WP:Advanced Convert coding". However, due to markup complexity, instead many users ask, at the bottom of the talk-page, Template_talk:Convert, for a more-experienced user to create the new subtemplate.
 * Q: The unit I need is not in the list, so can I create a subtemplate for it?
 * A: Yes, Convert allows anyone to create a new unit subtemplate, of the form Template:Convert/myunit, to handle a new unit-code named "myunit" by copying another unit subtemplate.
 * The process, for creating a subtemplate to convert a new unit-code, is explained on the page:


 * Q: When I reverse a conversion, from a&rarr;b to b&rarr;a, why is it off by 1 million (1,000,000)?
 * A: Sometimes, a new unit has a coding error. Inside a unit subtemplate, the parameter b also acts as a conversion divisor and needs to use outer parentheses "" in the calculation.
 * Beware a multiplication: b=(45/9)*1000,
 * which needs outer "":  b=( (45/9)*1000 )  to keep the "1000" in the divisor. Without the outer parentheses, the " *1000" would increase the calculation by 1,000x bigger, rather than 1,000x smaller, so the overall result zooms off by 1,000×1,000 or 1,000,000, as being 1 million too big.