Template:SI/doc

This template displays a value given in US Customary Units and converts it to the corresponding SI (metric) units. It accepts a wide array of abbreviations and standardizes the output for both units.

Usage

 * value: Required. The numerical value in the original unit. Positive, negative, and zero values are accepted.
 * unit: Required. The original unit. Supported values are:
 * Units of length:
 * inches (accepted abbreviations: in, inch, inches, in., ")
 * feet (ft, feet, foot, ft.,  ' )
 * yards (yd, yard, yards, yd.)
 * miles (mi, mile, miles, mi.)
 * leagues (league, leagues)
 * fathoms (fathom, fathoms)
 * nautical miles (M, NM, nmi, nm)
 * feet and inches (ft-in,  '" ): in this case, the value field must be in the format x'y or x'y", where x and y are numerical values. See the examples below.
 * Units of area:
 * square inches (sq. in, square inch, square inches, square in, sq inches, sq inch, sq in, in², in2)
 * square feet (sq. ft, sq ft, sf, ft², ft2)
 * square yards (sq. yd, sq yd, yd², yd2)
 * square miles (sq. mi, sq mi, mi², mi2)
 * acres (acre, acres)
 * Units of volume:
 * cubic inches (cu. in, cubic inch, cubic inches, cubic in, cu inch, cu in, cui, CI, c.i., in³, in3)
 * Cubic feet (cu. ft, cubic feet, cubic foot, cubic ft, cu feet, cu foot, cu ft, cu.ft, cuft, cb ft, cb.ft, cbft, cbf, feet³, foot³, ft³, ft3)
 * cubic yards (cu yd, cubic yard, cubic yards, yd³, yd3)
 * fluid ounces (fl. oz, fl oz, fl. oz., oz. fl.)
 * pints (pt, pint, pints)
 * quarts (qt, quart, quarts)
 * gallons (gal, gallon, gallons)
 * US bushels (bsh, bu, bushel, bushels)
 * fluid drams (fl dr, fl. dr, fl dr., fʒ, f ʒ, fluid drachm, fluidram, fluidrachm, fluid dram, fluid drams)
 * Units of mass:
 * pounds (lb, lb., lbs, lbs., pound, pounds)
 * ounces (oz, oz., ounce, ounces)
 * short tons (ton, tons)
 * drams (dr, dr., ʒ, drachm, dram, drams)
 * Units of temperature:
 * degrees Fahrenheit (F, °F, ℉, degrees F, degree F)


 * prefix: Optional. The desired SI prefix for the output. The template defaults to a unit with no prefix (such as meter, gram, cubic meter, etc.), but this can be overriden by selecting an appropriate prefix. Valid options are:
 * m
 * c
 * d
 * da
 * h
 * k
 * Additionally, the template is capable of converting volume to liters and milliliters if the user chooses from the prefixes l, L ml, or mL. It will result in an error message if it attempts to convert a non-volume quantity.
 * This parameter will be ignored if converting temperatures.


 * nounit: Optional. Not shown above. Set this to any value (typically yes) to have the output displayed as the converted value only, with no units. Typically useful if the conversion is to be used on another template.


 * long: Optional. Not shown above. Set this to any value (typically yes) to have the output displayed in long form without abbreviating units.

Under the Hood
The template identifies the type of unit in the input and uses an internal conversion table to convert to the unprefixed SI unit corresponding to that unit.


 * Units of length are converted to meters.
 * Units of area are converted to square meters.
 * Units of volume are converted to cubic meters.
 * Units of mass are converted to grams.
 * Units of temperature are converted to degrees Celsius.

If the user provides a prefix, the template automatically adjusts the converted value. For example, if the result of a conversion is 1000 m, if the template is called with the prefix k, the output will be displayed as 1 km. This also works for measurements of area and volume, with the proper adjustments. For example, a value of 1 m³ will be correctly converted to 1000000 cm³ if the prefix c is given.

The template also automatically identifies the number of significant figures on the input, by use of the Sigfig template, and displays the converted value with the same number of significant figures as the input. If the input contains fewer than two significant digits, the output defaults to two.

NOTE: This template relies on the Loops Extension being installed on the wiki.