Шаблон:Convert/Dual/rnd

Мавод аз Википедиа — донишномаи озод
Ҳуҷҷатгузорӣ

Usage

The Template:Convert/Dual/rnd rounds the amounts in a range of units, to set the default precision to match the highest of the two amounts, or increase the precision by 1 level if the two numbers are close in value. Examples:

  • {{convert|43|-|45|lb|kg}} → 43–45 pounds (19.5–20.4 кg)
  • {{convert|860|-|970|lb|kg}} → 860–970 pounds (390–440 kg)
  • {{convert|861|-|862|lb|kg}} → 861–862 pounds (390.5–391.0 кg)
  • {{convert|800|-|800.06|lb|kg}} → 800–800.06 pounds (362.87–362.901 kg)

A rounding parameter, such as "|2" will override the default precision and show 2 decimal digits. However, the default precision is auto-adjusted so that both amounts are treated as being similar in precision; otherwise a whole multiple of hundreds, such as "800" would have precision -1 while "800.06" would have precision 2, and the range "800–800.06" could be skewed as if spanning 10.06 units, rather than 0.06 units as would seem more logical. The auto-adjustment of precision treats both amounts as having the precision of the more-precise amount, but also increased by 1 level if the numbers are close in value.