Template:Inflation/doc

This template calculates inflation based on several inflation index data sets. The template uses an identification code for an inflation  (usually a country code), an original , an original   and either a specific reference   or by default the latest currently available end year , and calculates the equivalent value from historical economic changes between the original and reference years. For example, this template calls the United States inflation table located in the sub-template Template:Inflation/US/dataset to perform the U.S. calculation.

Aside from a convenient way to calculate values from different specified time periods, this template allows a regularly automatically updated calculation of value based on the most recent available inflation data. Whenever inflation tables are updated, potentially annually, all articles using this template have their displayed values updated accordingly.

Usage
The supported countries are listed below, with their  and available data periods:

Parameters

 * index (parameter 1), required, an index code for one of several available inflation indexes.
 * value (parameter 2), required, original price or value from which to base the inflation calculation on. Will ignore any commas, but must not have a currency symbol.
 * start_year (parameter 3), required, original year from which to base the inflation calculation on. Must be a year available in the chosen inflation index. As an exception to this, if the current year is specified and no  is specified, the template will output   unchanged, as it can be assumed an inflation of zero.
 * end_year (parameter 4), optional, reference year for which to calculate inflation. Must be higher (later) than , but not higher than the highest (most recent) year available in the chosen inflation index, and will default to the highest (most recent) available year if omitted.
 * digit sets the digits to which the value must be rounded. A negative value indicates rounding to an upper significant digit, and a positive value indicates a fractional digit including trailing zeros. Defaults to, i.e., without cents.
 * c will insert thousands separator commas into the calculated value.
 * eq will show an equivalent-to phrase, in the format, "equivalent to  in". Uses thousands separator commas.
 * cursign will set the currency symbol to be shown. Only functions when eq is used. Can use advanced symbol formats, but can only precede the calculated value. Default is.

Examples

 * ✅  → US $595
 * ✅  → US $595
 * ✅  → $21 million (equivalent to $ million in )
 * ✅  → $ in
 * ✅  → US $595
 * ✅  → US $595
 * ✅  → $21 million (equivalent to $ million in )
 * ✅  → $ in
 * ✅  → $ in
 * ✅  → $ in
 * ✅  → $ in
 * ✅  → $ in

It is possible to use the template in incorrect ways without producing error messages. Please read the warnings and appropriate uses of this template at the beginning of the template description.


 * ❌  → $595 ($ today)
 * ❌  → $100 ($ in 2024)
 * ❌  → $100 ($ adjusted for inflation)
 * ✅  → $100
 * ✅  → $100 (equivalent to $ in )
 * ❌  → Jane Doe amassed a fortune of $1 billion in 1975, making her worth $ billion in.
 * ❌  → Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $ billion in.

Entering invalid parameters or omitting required parameters will result in an error message and categorization into Category:Wikipedia pages containing incorrect parameters.



Currency conversion
This template is currency agnostic, which means it doesn't convert between different currencies. Thus, if you wanted to know how much DM 1,000.00 marks in 1960 are worth nowadays, entering would provide a result () still in marks, not in euros.

Consequently, if you need a result in another currency than the one in which the original value is stated, for now you must do the conversion manually, as in the following example which uses the defined conversion rate of € 1 = DM 1.95583:



A currency conversion template to ease these conversion tasks is planned. This section will be updated accordingly once it's developed.

Rounding
By default the values are calculated to the unit, as for all but very low values cents are undesirable. You can specify rounding with the r parameter which determines the number of decimals. To obtain cents use 2, but other values can be used, including negative ones: -3, for example, will round to the nearest thousand, -6 to the nearest million, and so on. It is advisable to avoid excessive precision; even if the start value is known to be exact, the template's result will not be because the inflation index tables are rarely accurate to more than about 1%, and a granularity of whole years is used.

Very large results
Very large results are expressed in scientific notation ("1.2E+14" instead of "120000000000000") which is normally not desirable. A workaround is to express the value to be inflated with fewer digits, adding a multiplier text such as "trillion" after the result, using the "Show preview" button as many times as needed, changing parameters until the best result is found:


 * ❌  → $ thousand
 * ✅  → $ million
 * ✅  → $ billion
 * ✅  → $ trillion
 * ✅  → $ billion
 * ✅  → $ trillion

The following section provides an automated way of avoiding this trial and error scenario.

Format price
is a template specifically designed to display price values, both big and small, in a readable way. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "".


 * ✅  → DM
 * ✅  → DM
 * ✅  → DM

Documenting
It's a good practice to provide a valid reference for the prices calculated with this template in articles where it's used. The template country was developed to ease this task. It accepts as its single parameter the same country codes used here, and will generate one or more appropriate footnotes. Typically, this is how a piece of text using it looks like:



Resulting in this converted code (notice the footnote link at the end):


 * In 1985 a unit cost on average $1,040. This is.

The footnote thus generated appears whenever or   is used in an article, usually in its "References" section. See below for the live example in this document's own References section, or click the above generated footnote to jump to it.

Limitations

 * 1) Currently it isn't possible to "de-inflate" a value to what it would have been in a previous year. If you need this functionality, please request it at the talk page. Adding it won't be difficult, but there's no point in doing so before someone actually needs it.
 * 2) Substitution isn't supported at all. Trying to   would only result in a long sequence of embedded parser code without any direct benefit. If you need to obtain an inflated price only once, please use the special ExpandTemplates page then copy the result and paste it at the desired location.

Developer documentation
An inflation series represents templates in the following categories: Modifications need to be made to: Current subpages:
 * Template:Inflation/index
 * Template:Inflation/index/dataset
 * Template:Inflation/index/startyear
 * Template:Inflation/doc/index (Which is then displayed at Inflation/name/dataset as the documentation, and needs to refer to the original data source)
 * Template:Inflation-fn
 * Template:Inflation-year