ವಿಷಯಕ್ಕೆ ಹೋಗು

ಟೆಂಪ್ಲೇಟು:Gconvert/doc

ವಿಕಿಪೀಡಿಯದಿಂದ, ಇದು ಮುಕ್ತ ಹಾಗೂ ಸ್ವತಂತ್ರ ವಿಶ್ವಕೋಶ

The Template:Gconvert is a variation of Template:Convert, intended for general-purpose conversions, where the amount being converted is exactly specified, rather than being a possible estimate. To round the results to another level, append a parameter "-2" or "2" (etc.) when using Gconvert.

{{Gconvert|<num>|<unit>|<newunit>}}
{{Gconvert|<num>|<unit>|<newunit>|2}} - show 2 decimals
{{Gconvert|<num>|<unit>|<newunit>|-2}} - round hundreds
{{Gconvert|<n>|<unit1>|<n2>|<unit2>|<newunit>}} -for 2 units

The parameters are identical to Template:Convert. The options include: abbr=off, abbr=on, sp=us, disp=/, disp=or, disp=s, disp=output number only, adj=on (explained below).

The following are the parameters handled by Template:Gconvert:

  • Parameter 1 is the amount to convert, can contain commas or a formula.
  • abbr=off - turns off abbreviation, shows "meters" or "feet" (default: abbr=on).
  • sp=us - triggers U.S. spelling, shows "meters" else "metres" (default: sp=en).
  • disp=/   - displays slash between numbers (default: disp=b).
  • disp=s   - displays slash between numbers (same as disp=/).
  • disp=or - displays "or" between numbers (default: parentheses).
  • disp=table - displays a hidden sort-tag for use in sortable tables.
  • disp=output number only - displays only the resulting number.
  • adj=on - turns on adjective-mode, shows "-m" (default: adj=off).

Those parameters are the same as in template {{Convert}}.

{{Gconvert|0.01|m}}   gives:  ೦.೦೧ metres (೦.೩೯೪ in)
{{Gconvert|1.03|m}}   gives:  ೧.೦೩ metres (೩ ft ೫ in)
{{Gconvert|3.6|m}}     gives:  ೩.೬ metres (೧೨ ft)
{{Gconvert|5|kg}}         gives:  ೫ kilograms (೧೧ lb)
{{Gconvert|8|km|abbr=on}}     gives:  ೮ km (೫ mi)
{{Gconvert|33|kg}}         gives:  ೩೩ kilograms (೭೩ lb)
{{Gconvert|83|kg}}         gives:  ೮೩ kilograms (೧೮೩ lb)
{{Gconvert|180|km}}       gives:  ೧೮೦ kilometres (೧೧೨ mi)
Heights
{{Gconvert|32|m|ft}}        gives:  ೩೨ metres (೧೦೫ ft)
{{Gconvert|200|m|ft}}      gives:  ೨೦೦ metres (೬೫೬ ft)
{{Gconvert|200.3|m|ft}}   gives:  ೨೦೦.೩ metres (೬೫೭ ft)
{{Gconvert|1,247|m}}     gives:  ೧,೨೪೭ metres (೪,೦೯೧ ft)

{{Gconvert|6|ft|2|in|cm}}     gives:  ೬ feet 2 inches (೧೮೮ cm)
{{Gconvert|6|ft|2|in|m}}       gives:  ೬ feet 2 inches (೧.೮೮ m)
Altitudes
{{Gconvert|8,848|m}}            gives:  ೮,೮೪೮ metres (೨೯,೦೨೯ ft) - Mount Everest
{{Gconvert|8,848|±|0.4|m}}    gives:  ೮,೮೪೮ ± ೦.೪ metres (೨೯,೦೨೯ ± ೧ ft)
Formulas and fractions
{{Gconvert| 16*90 |kg|lb}}       gives:  ೧೬*೯೦ kilograms (೩,೧೭೫ lb) - math formula
{{Gconvert|29*1,000 +29|ft|m}}     gives:  ೨೯ * ೧,೦೦೦+೨೯ feet (೮,೮೪೮ m)

{{Gconvert| 16*90.1 |kg|lb}}     gives:  ೧೬*೯೦.೧ kilograms (೩,೧೭೮ lb)
{{Gconvert| 16*90.1 |kg|lb|1}}   gives:  ೧೬*೯೦.೧ kilograms (೩,೧೭೮.೨ lb) - rounded 1 decimal
{{Gconvert|1+1/8|mi|km}}     gives:   18 miles (೧.೮ km)
{{Gconvert|1/3|yd|m}}           gives:  13 yard (೦.೩೦ m) - third of a yard
{{Gconvert|1.01|ft|m}}           gives:  ೧.೦೧ feet (೦.೩೧ m)
{{Gconvert|1.65*1.3333|ft|m|2}}     gives:  ೧.೬೫*೧.೩೩೩೩ feet (೦.೬೭ m)
{{Gconvert|1,765*1,100|km|mi}}     gives:  ೧,೭೬೫*೧,೧೦೦ kilometres (೧೨,೦೬,೩೯೨ mi)
{{Gconvert|10*pi|km|km}}     gives:  10*pi km (31.415926535898 km) ← with pi
{{Gconvert|10*pi*10|km|mi}}     gives:  ೧೦*pi*೧೦ kilometres (೧೯೫.೨೦೯೫೧೭೨೬೮೫ mi) ← circle area
{{Gconvert|ln 10|km|km}}     gives:  ln 10 km (2.302585092994 km) ← natural log
Both same units
{{Gconvert| 8*27|kg|kg}}        gives:  8*27 kg (216 kg) - both same units
{{Gconvert| 4*5.5|kg|kg|disp=equals}}   gives:  4*5.5 kg equals 22 kg
{{Gconvert| 35*10|m|m|disp=output number only}}   gives:  350
{{Gconvert| 45*20|kg|kg|disp=output only}}   gives:  900 kg
Various display options
{{Gconvert|89|cm|in|disp=/}}             gives:  ೮೯ centimetres / ೩೫ inches ← use slash
{{Gconvert|100|lb|kg|disp=b}}           gives:  ೧೦೦ pounds (೪೫ kg) ← use parentheses
{{Gconvert|55|mph|km/h|disp=or}}     gives:  ೫೫ miles per hour or ೮೯ kilometres per hour
{{Gconvert| 627 |kg|disp=output number only}}              gives:  ೧,೩೮೨
{{Gconvert| 350|L|USgal|disp=output only|abbr=on}}      gives:  ೯೨ US gal
{{Gconvert| 3.785|L|USgal|disp=output only}}                     gives:  ೧�೦೦೦ US gal
{{Gconvert| 60 |mph|disp=output only|abbr=on|lk=on}}    gives:  ೯೭ km/h
{{Gconvert| 0.622 |mph|disp=output only|abbr=off|lk=on}}   gives:  ೧.೦೦೧ km/h

Settings for precision

[ಬದಲಾಯಿಸಿ]

For calculations made by Template:Gconvert, the numbers are assumed to be precise to the last digit. The converted result will be displayed to an equivalent precision. For example, the number "200" is treated as 199+1, so for distance: 200 metres (656 ft).

Features for simplicity

[ಬದಲಾಯಿಸಿ]

Several features provide extra simplicity, beyond the operation of Template:Convert:

  • Gconvert allows the input amount to be a formula: 75*84 + 13.5
  • The input number (or formula) can contain commas: 1,500,175
  • When both units are the same, it just calculates: {{Gconvert|6*137|ft|ft}} → 6*137 ft (822 ft)
  • Gconvert validates parameters, such as: "Invalid parameter: abbr=nope, try abbr=on or abbr=off."
  • Numbers are treated as precise to the last digit (so "200" is treated as 199+1, rather than being roughly 2 hundred rounded from 151-249). Gconvert considers 200 m as 656 ft, whereas Convert rounds as 660 ft.
  • A space can precede the amount (spaces in Convert can cause: "Expression error...").

When changing from Gconvert to Template:Convert, then any commas or formulas, in the input amount, must be changed to simple numbers or fractions: 1/3 or 3/4. To use the same level of precision, add decimal point "." after numbers (such as "200." to indicate 199+1), when changing from Gconvert to Convert.

The following are potential issues:

  • A tiny decimal less than 0.03 is rounded to 3 decimal digits.
  • A formula can only contain division "/" for same-unit conversion, else treated as a fraction.
  • A formula with "pi" (or "ln" natural logarithm) should start with a number, not pi.
  • When changing from Gconvert to Convert, a leading blank before a number can cause the following message: "Expression error: Unexpected...". Write a number with no preceding space, as "627" (rather than "  627") if going back to Convert.