Gun Wiki
Advertisement
Template documentation (for the above template, sometimes hidden or invisible)

Template Convert is used to convert a value from one unit of measurement to another. The Template is fully identical in function to the template of the same name on Wikipedia. As such, this page will only provide the quick start to usage of the Template. Please see Template Documentation on Wikipedia for advanced knowledge on the Template.

Quick start

By default, the name of the input unit is shown, while the output is abbreviated using the unit's symbol. If wanted, names or symbols can be used, and the output precision can be specified.

  • {{convert|123.4|ft|m}} → 123.4 feet (37.6 m)
  • {{convert|123.4|ft|m|abbr=on}} → 123.4 ft (37.6 m)
  • {{convert|123.4|ft|m|abbr=off}} → 123.4 feet (37.6 metres)
  • {{convert|123.4|ft|m|abbr=off|sp=us}} → 123.4 feet (37.6 meters)
  • {{convert|123.4|ft|m|0}} → 123.4 feet (38 m)
  • {{convert|123.4|ft|m|3}} → 123.4 feet (37.612 m)

To avoid overlinking, units are not normally linked, but they can be when needed.

  • {{convert|12300|m2|rood|abbr=off|lk=on}} → 12,300 square metres (12.2 roods)
  • {{convert|12300|m2|rood|abbr=off|lk=out}} → 12,300 square metres (12.2 roods)

A convert can be used in an adjectival phrase, and user-specified text can be inserted.

  • {{convert|1500|ft|m|adj=on}} → 1,500-foot (460 m)
  • {{convert|1500|ft|m|adj=mid|-long}} → 1,500-foot-long (460 m)

If no output unit is specified, a default is used.

  • {{convert|123.4|ft}} → 123.4 feet (37.6 m)
  • {{convert|123.4|ft|abbr=on}} → 123.4 ft (37.6 m)
  • {{convert|1500|ft||adj=mid|-long}} → 1,500-foot-long (460 m)

The last example used || to explicitly show that the output unit has been omitted. If that is not done, the result is an error, and holding the mouse over the error message shows that "-long" is misinterpreted as the output unit.

The input and outputs can be "flipped". When flipped, an option such as |lk=out means "link the right-hand side".

  • {{convert|12300|m2|rood|abbr=off|lk=out}} → 12,300 square metres (12.2 roods)
  • {{convert|12300|m2|rood|abbr=off|lk=out|order=flip}} → 12.2 roods (12,300 square metres)
  • {{convert|12300|m2|rood|abbr=off|lk=in|order=flip}} → 12.2 roods (12,300 square metres)

The input value can be spelled.

  • {{convert|5|mi|km|spell=in|0}} → five miles (8 km)
  • {{convert|5|mi|km|spell=In|0}} → Five miles (8 km)

Ranges of values are supported.

  • {{convert|3|-|6|ft}} → 3–6 feet (0.91–1.83 m)
  • {{convert|3|to|6|ft|abbr=off|sp=us}} → 3 to 6 feet (0.91 to 1.83 meters)

A range can use more than two values.

  • {{convert|100|x|120|x|210|mm|in}} → 100 by 120 by 210 millimetres (3.9 in × 4.7 in × 8.3 in)
  • {{convert|100|x|120|x|210|mm|in|abbr=on}} → 100 mm × 120 mm × 210 mm (3.9 in × 4.7 in × 8.3 in)
  • {{convert|100|by|120|by|210|mm|in}} → 100 by 120 by 210 millimetres (3.9 by 4.7 by 8.3 in)

Some input units consist of multiple components.

  • {{convert|5|ft|8|in}} → 5 feet 8 inches (1.73 m)
  • {{convert|11|st|3|lb|kg}} → 11 stone 3 pounds (71 kg)

An output can be a combination of several units.

  • {{convert|123|nmi|km mi}} → 123 nautical miles (228 km; 142 mi)
  • {{convert|123|hPa|psi inHg|abbr=on|lk=on}} → 123 hPa (1.78 psi; 3.6 inHg)

Some outputs consist of multiple units.

  • {{convert|123.4|m|ydftin}} → 123.4 metres (134 yd 2 ft 10 in)
  • {{convert|123.4|kg|stlb}} → 123.4 kilograms (19 st 6 lb)

Rounding

By default, the output value is rounded to adjust its precision to match that of the input. An input such as 1234 is interpreted as 1234 ± 0.5, while 1200 is interpreted as 1200 ± 50, and the output value is displayed accordingly, taking into account the scale factor used in the conversion.

If the default is not wanted, the precision of output values can be specified using:

  • |N (where N is a number) to specify the number of digits to be displayed after the decimal mark (round output to N decimal places).
  • |-N (where -N is a negative number) to specify the number of digits before the decimal mark that should be replaced with zero (round output to nearest 10N).
  • |sigfig=N (where N is a positive number) to specify the number of significant digits (round output to N significant figures).
  • |round=5 to round the output to the nearest multiple of 5. The round value can be 0.5, 5, 10, 25 or 50.

Examples:

  • {{convert|1234|ft|m}} → 1,234 feet (376 m)
  • {{convert|1234|ft|m|2}} → 1,234 feet (376.12 m)
  • {{convert|1234|ft|m|-1}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|round=5}} → 1,234 feet (375 m)
  • {{convert|1234|ft|m|round=10}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|round=25}} → 1,234 feet (375 m)
  • {{convert|1234|ft|m|round=50}} → 1,234 feet (400 m)
  • {{convert|1234|ft|m|sigfig=2}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|sigfig=4}} → 1,234 feet (376.1 m)
  • {{convert|1230|ft|m}} → 1,230 feet (370 m)
  • {{convert|1230|ft|m|0}} → 1,230 feet (375 m)
  • {{convert|1230|ft|m|1}} → 1,230 feet (374.9 m)
  • {{convert|5670|sqft}} → 5,670 square feet (527 m2)
  • {{convert|5670|sqft|-2}} → 5,670 square feet (500 m2)
  • {{convert|7x8x12|ft|abbr=on|round=0.5}} → 7 ft × 8 ft × 12 ft (2 m × 2.5 m × 3.5 m)

An input value such as 5000 is assumed to have one significant figure, while 5001 has four. If wanted, "5000." can be used to specify an input number that has four significant figures.

  • {{convert|5000|m}} → 5,000 metres (16,000 ft)
  • {{convert|5000.|m}} → 5,000. metres (16,404 ft)

Spell

Use US (en-US) spelling for unit names

Use |sp=us to specify that unit names should be displayed with US spelling:

  • {{convert|6|km}} → 6 kilometres (3.7 mi)
  • {{convert|6|km|sp=us}} → 6 kilometers (3.7 mi)
Spell out numbers in words

Use |spell=in to specify that the input value should be spelled in words, or |spell=In (uppercase "I") to start with an uppercase letter:

  • {{convert|5|mi|km|spell=in}} → five miles (8.0 km)
  • {{convert|5|mi|km|spell=in|abbr=off|0}} → five miles (8 kilometres)
  • {{convert|5|mi|km|spell=In|0}} → Five miles (8 km)
  • {{convert|5|mi|km|spell=In|abbr=off|0}} → Five miles (8 kilometres)
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In}} → Two and a quarter miles (4 kilometres)
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In|sp=us}} → Two and a fourth miles (4 kilometers)

The input and output can be "flipped", as shown in these examples. Logically, the resulting first number is spelled:

  • {{convert|5|mi||0|order=flip|spell=in}} → eight kilometres (5 mi)
  • {{convert|5|mi||0|order=flip|spell=In|abbr=off}} → Eight kilometres (5 miles)

The "||" provides an empty output unit to mean "use the default".

Both input and output values can be spelled:

  • {{convert|5|mi|m|-2|spell=on|sp=us|abbr=off}} → five miles (eight thousand meters)
  • {{convert|5|mi|m|-2|spell=On|sp=us|abbr=off}} → Five miles (eight thousand meters)

Thousands separator

Commas in input numbers are ignored. Gaps are not allowed in input.

In output, by default, the thousands separator is the comma:

  • {{convert|1234567|m|ft}} → 1,234,567 metres (4,050,417 ft)
  • {{convert|1,234,567|m|ft}} → 1,234,567 metres (4,050,417 ft)

Set |comma=off to remove separators from the result:

  • {{convert|1,234,567|m|ft|comma=off}} → 1234567 metres (4050417 ft)

Setting |comma=5 adds a separator only when the number of digits is 5 or more:

  • {{convert|1234|m|ft}} → 1,234 metres (4,049 ft)
  • {{convert|1234|m|ft|comma=5}} → 1234 metres (4049 ft)
  • {{convert|12345|m|ft|comma=5}} → 12,345 metres (40,502 ft)

Set |comma=gaps to use a small space for thousands grouping. If the resulting number is copied, only the digits are copied (the gaps are omitted).

  • {{convert|1234567|m|ft}} → 1,234,567 metres (4,050,417 ft)
  • {{convert|1234567|m|ft|comma=gaps}}1234567 metres (4050417 ft)

Gaps are inserted on both sides of the decimal mark. However, by default, no gap is inserted before a single digit. If a gap is always wanted, |comma=gaps3 can be used.

  • {{convert|1234.98765|m|ft|comma=gaps}}1234.98765 metres (4051.7968 ft)
  • {{convert|1234.98765|m|ft|comma=gaps3}}1234.98765 metres (4051.7968 ft)
  • {{convert|1234.9876|m|ft|comma=gaps}}1234.9876 metres (4051.797 ft)
  • {{convert|1234.9876|m|ft|comma=gaps3}}1234.9876 metres (4051.797 ft)
  • {{convert|1.2349876|m|ft|comma=gaps}}1.2349876 metres (4.051797 ft)
  • {{convert|1.2349876|m|ft|comma=gaps3}}1.2349876 metres (4.051797 ft)

Fractions

An input value can be specified as a fraction.

  • {{convert|1/2|in|mm|1}}12 inch (12.7 mm)
  • {{convert|1/2|in|mm|1|adj=on}}12-inch (12.7 mm)
  • {{convert|2+1/2|in|mm|1}}2 12 inches (63.5 mm)
  • {{convert|-2-1/4|in|mm|1}}−2 14 inches (−57.2 mm)
  • {{convert|1/2|in|mm|1|spell=in}} → one-half inch (12.7 mm)

If two slashes are used, a horizontal fraction bar is used.

  • {{convert|1//2|in|mm|1}}1/2 inch (12.7 mm)
  • {{convert|2+1//2|in|mm|1}}2 1/2 inches (63.5 mm)

An output can be expressed with a fraction using |frac=N where N is the denominator. For example, |frac=8 rounds the output to the nearest eighth.

  • {{convert|219|mm|in|abbr=on}} → 219 mm (8.6 in)
  • {{convert|219|mm|in|abbr=on|frac=2}} → 219 mm (8 12 in)
  • {{convert|219|mm|in|abbr=on|frac=4}} → 219 mm (8 12 in)
  • {{convert|219|mm|in|abbr=on|frac=8}} → 219 mm (8 58 in)
  • {{convert|222|mm|in|abbr=on|frac=8}} → 222 mm (8 34 in)

A fraction is applied to the output unit (if there is only one), or to non-SI units (if using a combination), except that if a precision is also specified, the fraction only applies to the hand unit.

  • {{convert|18.45|in|m|frac=2}} → 18.45 inches (12 m)
  • {{convert|18.45|in|ft in hand cm|frac=2}} → 18.45 inches (1 12 ft; 18 12 in; 4.2 12 hands; 46.9 cm)
  • {{convert|18.45|in|ft in hand cm|frac=2|1}} → 18.45 inches (1.5 ft; 18.5 in; 4.2 12 hands; 46.9 cm)
Visit Template:Convert/doc to change this text! (How does this work?)
Done making changes? Refresh this text! (Why?)


Advertisement