Category:Unit display

From Wikipedia, the free encyclopedia

These are templates which print figures with their wikilinked units and if the second parameter is set it converts them to either imperial or metric system too. If both values are printed, then the second one is in brackets. Both parameters should be unformated numbers, the first one is the actual value, the second one is the number of decimal digits for the calculated value. The numbers are then nicely formated.

Examples:

  • {{Unit km| 1487}} renders as: 1,487 km
  • {{Unit km| 1487.25| 2}} renders as: 1,487.25 km (924.13 mi)
  • {{Unit mi| 1487}} renders as: 1,487 mi
  • {{Unit mi| 1487.25| 2}} renders as: 1,487.25 mi (2,393.5 km)

It is important to note that negative values are OK for the rounding parameter, which is very useful for converting approximate values:

  • {{Unit ft| 14000| 0}} renders as: 14,000 ft (4,267 m)
  • {{Unit ft| 14000| -1}} renders as: 14,000 ft (4,270 m)
  • {{Unit ft| 14000| -2}} renders as: 14,000 ft (4,300 m)