ಟೆಂಪ್ಲೇಟು:Convert/scale/doc
This is a documentation subpage for ಟೆಂಪ್ಲೇಟು:Convert/scale It may contain usage information, categories and other content that is not part of the original ಟೆಂಪ್ಲೇಟು page. |
{{Convert/scale}}
allows a custom scale formula to be used to convert a unit into another unit. The formula used is:
- output = round(a × (
{{{1}}}
+ offset) + b, r)
- output = round(a × (
That is, output is calculated by adding parameters {{{1}}}
and offset, multiplying the result by parameter a, adding parameter b, then rounding according to parameter r.
Usage
ಬದಲಾಯಿಸಿThe format is:
- {{convert/scale|10.0|ww|zz|a=6.7|b=0.4|r=3}} → 10.0 ww (67.400 zz)
- {{convert/scale|4|m|ft|scale=3.28|add=0}} → 4 m (13.1 ft)
Synonyms for parameter a are f or scale. A synonym for parameter b is add.
The output of the template is the following space-separated group of values:
{{{1}}} {{{2}}}
(output{{{3}}}
)
Non-breaking spaces are the default between values and units, but can be reset by using a leading space or " " or "-" prefix before words.
If parameter sep is present, it replaces the opening parenthesis and there is no closing parenthesis.
The parameters are:
Param | Description |
---|---|
1 | Amount to convert (can have a fraction, default: 2+3/4) |
2 | Literal input unit name or symbol (can have prefix "-" or space) |
3 | Literal output unit name or symbol (or prefix "-" or space) |
a or f or scale |
Scale factor (default: 2.0), to divide by 4, use a=(1/4) |
offset | Initial offset amount (default: 0.0) |
b or add | Final shift amount (default: 0.0) |
r | Number of decimal places in the result. Negative numbers round to nearest multiple of powers of 10 (i.e. -3 rounds to the nearest thousand). i.e., rounding is to the nearest multiple of 10−r . The default value of r is the precision of parameter 1, plus 1.
|
sep | Separator text between input unit & output amount (default: "( )" parentheses) |
Examples:
Wikitext | Result |
---|---|
{{Convert/scale |3.5 |ins |outs |a=2 |b=1}}
|
೩.೫ ins (೮.೦೦ outs) |
{{Convert/scale |10.0 |www |zzz |a=6.70 |b=0.5}}
|
೧೦.೦ www (೬೭.೫೦ zzz) |
{{Convert/scale |12.0 |[[erg]]s |korts |a=3.85 |offset=-2 |b=0.4}}
|
೧೨.೦ergs (೩೮.೯೦ korts) |
{{Convert/scale |1.2 |million m<sup>2</sup> |million ft<sup>2</sup> |a=10.764 |r=0}}
|
೧.೨ million m2 (೧೩ million ft2) |
{{convert/scale |2|-foot|m|a=(1/3.28) }}
|
೨-foot (೦.೬ m) |
{{convert/scale |345| kilometres| miles|a=1.6093}}
|
೩೪೫ kilometres (೫೫೫.೨ miles) |
{{convert/scale |80| miles|km|a=(1/1.6093) }}
|
೮೦ miles (೫೦ km) |