Template:Inflation

维基百科,自由的百科全书
跳转至: 导航搜索
文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

模板有三個必填參數,包括country_codevaluestart_year。通脹率資料可在模板的子頁面找到及編輯,如美國通脹率資料存在Template:Inflation/US/dataset,每年有新的資料,所有引用此模板的頁面便會自動更新。

另外,編者可使用end_year參數,指定某年之間的通脹率。

用法[编辑]

{{Inflation|country_code|value|start_year|r=digit}}
{{Inflation|country_code|value|start_year|end_year|r=digit}}

此模板支援以下的貨幣:

Country name 國家代碼(country_code) 最早支援年份(start_year
澳洲[1] AU 1901
加拿大[2] CA 1916
德國[3] DE 1882
英國[4] UK 1264
美國[5] US 1800
  • end_year:如有輸入,數值必須比start_year大,比現時年份小。沒有輸入則預設為今年。
  • r=digit:設定四捨五入至某個數值,預設為0。

例子:

參數不當會顯示NaN

提示與技巧[编辑]

貨幣轉換[编辑]

此模板不能轉換貨幣單位,因此,如果想知道1960時的1000德國馬克於現在的價值,輸入{{Inflation|DE|1000|1960|r=2}}顯示的數值仍爲德國馬克,而非歐元。

所以,如要轉換貨幣單位,需要手動輸入數式,下面例子定義€ 1 = DM 1.95583:

  • Green tickY {{#expr:({{Inflation|DE|1000|1960|r=2}} / 1.95583) round 2}}
四捨五入[编辑]

|r=參數可以定義要四捨五入的數位,輸入|r=2會約至2個小數點;輸入|r=-3會約至千位;輸入|r=-6會約至百萬位,如此類推。

Formatnum[编辑]

為達到更佳效果,編者可以使用{{formatnum:}},用{{Formatprice}}也可。這個功能為數值每三個數位加上一個分隔逗號,但編者不能控制顯示多少小數位。

  • Green tickY DM {{formatnum:{{Inflation|DE|1000000|1957|1978}}}}.00 = DM NaN.00
  • Green tickY £{{formatnum:{{Inflation|UK|1000000|1323|1978|r=-4}}}} = £114,610,000
  • Green tickY ${{formatnum:{{Inflation|US|1000000|1990|r=2}}}} = $1,833,163.53

參考資料[编辑]

  1. ^ Australian Consumer Price Inflation figures follow the Long Term Linked Series provided in Australian Bureau of Statistics (2011) 6461.0 – Consumer Price Index: Concepts, Sources and Methods, 2011 as explained at §§3.10–3.11; this series comprises "from 1901 to 1914, the A Series Retail Price Index; from 1914 to 1946–47, the C Series Retail Price Index; from 1946-47 to 1948-49, a combination of the C Series Index, excluding rent, and the housing group of the CPI; and from 1948–49 onwards, the CPI." (3.10). Retrieved May 4, 2015
  2. ^ Canadian inflation numbers based on Statistics Canada. "Consumer Price Index, historical summary". CANSIM, table (for fee) 326-0021 and Catalogue nos. 62-001-X, 62-010-X and 62-557-X. And Consumer Price Index, by province (monthly) (Canada) Last modified 2016-01-22. Retrieved March 2, 2016
  3. ^ German inflation numbers based on data available from Deutsches Statistisches Bundesamt.
  4. ^ 4.0 4.1 UK Consumer Price Index inflation figures are based on data from Gregory Clark (2016), "The Annual RPI and Average Earnings for Britain, 1209 to Present (New Series)", MeasuringWorth.com.
  5. ^ Federal Reserve Bank of Minneapolis Community Development Project. Consumer Price Index (estimate) 1800–. Federal Reserve Bank of Minneapolis. [January 2, 2017].