Template talk:Inflation/Archive 4

Latest comment: 7 months ago by Chaotic Enby in topic Edit request 26 August 2025
Archive 1Archive 2Archive 3Archive 4

How does "r" work?

Can somebody explain to me how the "r" (rounding) parameter works? I understand the concept of significant digits, but what r does seems only vaguely related to that, and expressed in a way I find inscrutable. I've never used anything other than negative values, and usually end up doing trial-and-error until I find a value that does what I want. I tried looking at the template source code, and ran away screaming in horror. RoySmith (talk) 13:29, 4 February 2025 (UTC)

It's not about significant digits exactly. It's about where the rounding happens, either at (r=0), after (r=2, for example), or before (r=-3) the decimal point. To get hundredths of a dollar or other currency, use r=2 (i.e. 2 digits to the right of the decimal point). To get the number rounded to the nearest thousand, use r=-3 (i.e. 3 digits to the left of the decimal point). That's what the documentation appears to say, anyway. If you have examples that don't match that explanation, please provide them here. – Jonesey95 (talk) 01:13, 6 February 2025 (UTC)
@Jonesey95 The main issue that I can see is that the template cuts off final zeroes, even if r= is specified, so you end up with silly things like {{Inflation|index=US-GDP|value=1|start_year=2005|r=2}} giving 1.5, not 1.50. This really does need fixing, in my opinion. Theknightwho (talk) Theknightwho (talk) 20:07, 14 February 2025 (UTC)
I agree that seems like a bug. – Jonesey95 (talk) 21:17, 14 February 2025 (UTC)

It is easier to understand with an example:

  • {{formatnum:{{Inflation|US|2923706.026|2009|r=3}}}} —> 4,387,599.783 (3 decimal places)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=2}}}} —> 4,387,599.78 (2 decimal places)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=1}}}} —> 4,387,599.8 (automatic rounding removes the 0)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=0}}}} —> 4,387,600 (whole number)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=-1}}}} —> 4,387,600 (-1 decimal place)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=-2}}}} —> 4,387,600 (-2 decimal place)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=-3}}}} —> 4,388,000 (-3 decimal place)

Betty Logan (talk) 20:33, 6 February 2025 (UTC)

Edit request 8 February 2025

Description of suggested change: Per https://www.minneapolisfed.org/about-us/monetary-policy/inflation-calculator/consumer-price-index-1800-, the 2024 data can be added as 944.9 for Inflation/US/dataset. Klinetalkcontribs 19:21, 8 February 2025 (UTC)

 Done * Pppery * it has begun... 22:03, 24 February 2025 (UTC)

Edit request 25 February 2025

Description of suggested change: please update the NZ year in {{Inflation/year}} and the citation year in {{Inflation/fn}} from 2021 to 2024, see update to Template:Inflation/NZ/dataset.

Diff:

NZ = 2021
+
NZ = 2024

Jon (talk) 03:30, 25 February 2025 (UTC)

 Done * Pppery * it has begun... 17:11, 25 February 2025 (UTC)

Comma consistency

I've just noticed that {{Inflation}} Will ignore any commas. Why? Isn't it possible to have the input/output figures consistent with each other?

My example:

{{Inflation|UK|12000|1385|cursign=£|fmt=eq|orig=yes}}

results in:

£12000 (equivalent to £12,360,688 in 2025) (i.e., £12000, no comma, £12 million, commas.)

Cheers, Fortuna, imperatrix 10:22, 13 June 2025 (UTC)

The above example is confusing because it has no comma in the input but we worked it out at Wikipedia:Help desk#Template:Inflation (comma (in)consistency). Commas are only ignored when the value is used in calculations, not when the original value is displayed with |orig=yes, so "Will ignore any commas" in the documentation seems a little misleading. It turned out the poster had an unrelated issue: An empty |r= causes an error. {{Inflation|KRW|100|2000|r=}} produces:
Error when using {{Inflation}}: NaN/calculation error please notify Template talk:Inflation.
Templates are usually coded to produce the same with an empty and an omitted parameter. It's done with the simple {{{r|}}} if there is no default but it gets messier with a default. If the call has an empty |r= then {{{r|0}}} will produce the empty string and not 0. I suggest this workaround to replace the two {{{r|0}}}: {{#if:{{{r|}}}|{{{r}}}|0}}. It says: If r is both set and non-empty then use r, otherwise use 0. PrimeHunter (talk) 13:51, 13 June 2025 (UTC)
Thanks PrimeHunter, apologies for posting twice. I realised after posting here that it didn't seem to get much footfall so went to yon desk instead. I meant to delete this one. Fortuna, imperatrix 09:23, 14 June 2025 (UTC)

Invalid year issue

Some weird stuff's happening on Template:ShipCost/doc and Template:AircraftCost/doc due to this template.
{{ShipCost|FRA|3600000|year=1795}} Works fine.
{{ShipCost|FRA|3600000|year=1796}} hell breaks loose. Claiming NaN and reports a misnested strong error.
{{AircraftCost|FRA|3600000|year=1795}} Works fine.
{{AircraftCost|FRA|3600000|year=1796}} Broken, claiming NaN and reports a misnested strong error.
If someone knows what's going on here and can correct the issue, would you? Thanks! Zinnober9 (talk) 23:09, 1 March 2025 (UTC)

@Zinnober9, I think I fixed it. The problem is at {{ItemCost}}, the FR dataset here does not have data for 1796 and 1797, but the minimum year for {{ItemCost}} was set to 1795, that’s the reason for the broken templates above for year 1796 and 1797. Tvpuppy (talk) 01:18, 7 July 2025 (UTC)

Edit request 22 July 2025

please update the CL year in {{Inflation/year}} and the citation year in {{Inflation/fn}} from 2020 to 2024, see update to Template:Inflation/CL/dataset.

Diff:

2020
+
2024

B1mbo (talk) 20:14, 22 July 2025 (UTC)

 Completed. P.I. Ellsworth, ed.  welcome!  20:23, 23 July 2025 (UTC)

AWB request relating to this template

Just an FYI: see Wikipedia:AutoWikiBrowser/Tasks § Articles using Template:Inflation with CURRENTYEAR. Graham87 (talk) 07:27, 15 June 2025 (UTC)

I got no response there, so I'll go through and fix them myself. Graham87 (talk) 07:34, 19 July 2025 (UTC)
All done ... including those that use the template {{CURRENTISOYEAR}}. Graham87 (talk) 11:20, 29 July 2025 (UTC)

UK inflation footnote source: date is 2017, should be newer?

Thanks for all the great work on this template. Regarding the footnotes for source of inflation data, for UK, it is

 {{Inflation/fn|UK}} 

producing a footnote that specifically names the year "2017" as the date of the a source (I'm trying to copy & paste the text of the footnote, but the paste is failing) The source is website: https://measuringworth.com/datasets/ukearncpi/ which appears to be up-to-date thru 2024. So, the "2017" date displayed in the footnote should be updated from "2017" to "2023" or "2024". Noleander (talk) 15:06, 31 July 2025 (UTC)

Template-protected edit request on 29 July 2025

In Template:Inflation/year: | NL = 2024

In Template:Inflation/fn, add second source:

{{#tag:ref|'''1900–present:''' {{cite web |title=Prijzen toen en nu |url=https://www.cbs.nl/nl-nl/visualisaties/prijzen-toen-en-nu |language=nl |website=cbs.nl |publisher=[[Centraal Bureau voor de Statistiek]]}} '''1450–1900:''' {{cite web |date=2021-06-14 |title=Value of the Guilder versus Euro |url=https://hdl.handle.net/10622/VY7UY3 |website=iisg.amsterdam |publisher=[[International Institute of Social History]] |url-status=dead |archive-url=https://web.archive.org/web/20240524174557/https://iisg.amsterdam/en/research/projects/hpw/calculate.php |archive-date=2024-05-24 |access-date=2025-07-29}}|name=inflation-NL|group={{{group|}}} }}

1900–present: "Prijzen toen en nu". cbs.nl (in Dutch). Centraal Bureau voor de Statistiek. 1450–1900: "Value of the Guilder versus Euro". iisg.amsterdam. International Institute of Social History. 2021-06-14. Archived from the original on 2024-05-24. Retrieved 2025-07-29.}}

TheThomanski | t | c | 18:26, 29 July 2025 (UTC)

 Done * Pppery * it has begun... 04:33, 2 August 2025 (UTC)

Template-protected edit request on 25 August 2025

''[http://www.jstor.org/stable/43295548 Consumer Prices and Real Wages in Taiwan and Korea Under Japanese Rule]''. Hitotsubashi Journal of Economics should be "[http://www.jstor.org/stable/43295548 Consumer Prices and Real Wages in Taiwan and Korea Under Japanese Rule]". ''Hitotsubashi Journal of Economics''

per MOS:MINORWORK and MOS:MAJORWORK. —DocWatson42 (talk) 08:20, 25 August 2025 (UTC) DocWatson42 (talk) 08:20, 25 August 2025 (UTC)

 Completed. P.I. Ellsworth, ed.  welcome!  15:30, 25 August 2025 (UTC)
Thank you. ^_^ —DocWatson42 (talk) 20:10, 25 August 2025 (UTC)
Happy to help! Paine  21:36, 25 August 2025 (UTC)

Sub-Templates nominated for deletion

A number of countries sub-templates, for example, Egypt's. have been nominated for deletion here All the best: Rich Farmbrough 15:17, 17 September 2025 (UTC).

More on precision

A while ago I asked about the r parameter. Coming back to that problem, I'm forced to wonder why we have to do this at all. Not only is it finicky and complicated to understand, it's the kind of thing computers are very good at doing. I almost universally see people misuse the template and trying to correct them is usually an exercise in futility. My training is in engineering, where the concept of significant digits was pounded into our heads; if we gave either too many or too few significant digits on an exam problem, it would be marked wrong. I don't expect most wikipedia authors to understand with that level of technical rigor how that works so it seems absurd to assume they will be able to figure out the correct r value to use.

Why can't this be totally automatic? I don't know Lua, but it looks like a perfectly reasonable programming language with good support for the usual range of math and string operations. Writing a Lua module to do this completely automatically seems like it would be a straight-forward exercise for somebody who knows the language. RoySmith (talk) 15:23, 1 October 2025 (UTC)

The more I dig into this, the more confused I get. I decided to work a few examples by hand to make sure I could replicate the template results (User:RoySmith/sandbox).

  • ${{Inflation|US-GDP|1000|1800|fmt=c}} in {{Inflation/year|US-GDP}}{{Inflation/fn|US-GDP}} (US-GDP)
  • ${{Inflation|US|1000|1800|fmt=c}} in {{Inflation/year|US}}{{Inflation/fn|US}} (US)

gives me

  • $23,367 in 2024[1] (US-GDP)
  • $18,971 in 2025[2] (US)

i.e.:

$22,769 in 2023[1] (US-GDP)
$18,527 in 2024[2] (US)


Clicking through to the first cited source and retrieving the data for US GDP Deflator for 1800 to 2023 gets me 5.37 and 122.39 for the endpoints. Calculating 1000 * (122.39 / 5.37) gives me $22,791. But the template said it was $22,769. That's pretty close, but I would expect a computer could do math better than pretty close. So what's going on there?

Clicking through to the second source, I get 51 and 942.7 for the endpoints. 1000 * (942.7 / 51) = 18,484. Again, not matching the template value of $18,527. Again, what's going on?



Multiref template and cs1 templates

Why is IN the only currency (per the documentation) for which {{inflation/fn}} uses CS2? I think it would be much cleaner if all of the templates used CS1 templates, e.g., {{cite journal}}.

It might also be clearer which sources point to which years by using a template. I would advocate for using {{multiref}} or {{multiref2}}. Snowman304|talk 01:36, 11 October 2025 (UTC)

Iranian rials does not go past 1398?

I am looking at Kandovan Tunnel to insert: {{inflation|IR|24,853,400|1938}} which generates:

  • Error when using {{Inflation}}: |start_year=1938 (parameter 3) is greater than the latest available year (1398) in index "IR".

Indeed this template's documentation says the limit is 1398, with the source link dead. Is this an error or some sort of historical currency limitation?

Personal side note: the source used in the article - I will need to figure out a conversion to US dollars at some point. Commander Keane (talk) 11:55, 7 August 2025 (UTC)

This appears to be due to Iran using the Solar Hijri calendar, which has a 621 year offset. It isn't very intuitive for the template to use it, and it could be good to have an alternate way to input Common Era years when computing Iranian currency. Chaotic Enby (talk · contribs) 00:27, 19 October 2025 (UTC)

Template-protected edit request on 14 September 2025

Request to change | BD = 2023 to | BD = 2024 for Template:Inflation/year. Mehedi Abedin 09:50, 14 September 2025 (UTC)

 Done Chaotic Enby (talk · contribs) 12:03, 19 October 2025 (UTC)

Template-protected edit request on 16 October 2025 (2)

Change: US-CAP = 2023

To: US-CAP = 2024 Titan877 (talk) 02:41, 16 October 2025 (UTC)

 Done Chaotic Enby (talk · contribs) 12:03, 19 October 2025 (UTC)

Edit request 26 August 2025

Request: change | TR = 2021 to | TR = 2024 on Template:Inflation/year. Zoozaz1 (talk) 20:45, 26 August 2025 (UTC)

 Done Chaotic Enby (talk · contribs) 12:04, 19 October 2025 (UTC)