Template:To USD round
This template converts a value given in the national currency of a given country to a round US dollar figure. The intended use is for large round figures, when you don't want 3.2 million euros turning into $3,706,240 dollars, you just want a round figure like $3,700,000. It tries to mimic the same number of significant figures, as are present in the original amount. The template uses values published by the IMF.[1]
Syntax
{{To USD round|AMOUNT|COUNTRY|YEAR|sf=SIGFIG}}
- AMOUNT is the value in the local currency to be converted.
- COUNTRY is the country name or 3-letter ISO code for the country whose currency is being converted.
- YEAR (optional) is the year to use for the US dollar exchange rate value against the currency of the other country. The default is currently 2019. Possible values: 2002, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019.
- SIGFIG (optional) is a numerical value. If present, the converted value is displayed to the that number of significant figures. The default is the number of significant figures in AMOUNT.
Examples
{{To USD round|5200|Mexico}}
displays 270. That is, 5200 Mexican pesos would exchange to roughly 270 US dollars (to two signficant digits) at the 2019 exchange rate.{{To USD round|5200|MEX}}
also displays 270.{{To USD round|1250|FRA}}
displays 1,400.{{To USD round|5200|MEX|sf=3}}
displays 275.{{Formatnum:{{To USD round|18000|RUS}}}}
displays 3,100.{{To USD round|5200|MEX|year=2009}}
displays Undefined year "2009" since data for 2009 has not been defined. It will add the page to Category:Pages using an undefined year in Template:To USD round
{{To USD round|586000|BRA|year=2011}}
= Formatting error: invalid input when rounding{{To USD round|586000|BRA|year=2017}}
= 180,000{{To USD round|620000000|BRA|year=2015}}
= Formatting error: invalid input when rounding{{To USD round|620000000|BRA|year=2015|sf=4}}
= Formatting error: invalid input when rounding{{To USD round|640|MEX|sf=5}}
displays 33.810. # Some combos make no sense; USD doesn't have tenths of a cent.
See also
- Template:US$
- Template:Inflation: Calculates a value in a given country in a given year based on an amount of currency in the same country in another year.
- Template:To USD
- Template:Round
- Template:significant figures
- Template:International dollars: Converts a value in a given country in a given year to international dollars.
{{formatnum:}}
Data subtemplates
References
- ↑ "Official exchange rate (LCU per US$, period average)". http://data.worldbank.org/indicator/PA.NUS.FCRF. Retrieved 14 April 2013.
TemplateData
TemplateData for To USD round
Template to convert other currencies into United States dollars, by year, based on information from the International Monetary Fund, and with selected number of significant figures
Parameter | Description | Type | Status | |
---|---|---|---|---|
amount | 1 | value in foreign currency to convert to USD
| Number | required |
country code | 2 country | ISO 3166-1 alpha-3 country code
| Line | required |
year | year | Year to convert currency. Values: 2002, 2011–2019.
| Number | optional |
significant figures | sf | If numeric, rounds to that many significant figures. If omitted, rounds to number of significant figures in 'amount'.
| Number | optional |