Langbahn Team – Weltmeisterschaft

Template talk:Inflation

2 years ago, I created a Lua version of Template:Inflation/year at Template:Inflation/year/sandbox that uses Module:Inflation to automatically determine the end year of the data so that the template won't need to be updated manually. There were no objections to implementing it when it was discussed at Template_talk:Inflation/Archive_3#c-Ahecht-20220718174100-New_sandbox_version, but for whatever reason I never actually did so. Since so much time has passed, I thought I'd ask again here before copying it over. --Ahecht (TALK
PAGE
)
20:14, 10 September 2024 (UTC)[reply]

 Done. Let me know if this broke anything that I didn't catch already. --Ahecht (TALK
PAGE
)
18:50, 19 September 2024 (UTC)[reply]
I think it's broken. I used it on James Brudenell, 7th Earl of Cardigan and it returns "The time allocated for running scripts has expired". AntientNestor (talk) 20:22, 19 September 2024 (UTC)[reply]
I have reverted this edit per multiple reports at WP:VPT today. Izno (talk) 21:32, 19 September 2024 (UTC)[reply]
@AntientNestor, Izno You must've been reverting at the exact same time I was attempting to, as I didn't even get an edit conflict notice after hitting undo. I'll investigate the performance issues further. --Ahecht (TALK
PAGE
)
21:34, 19 September 2024 (UTC)[reply]
Thanks for the prompt response. It looks ok again. AntientNestor (talk) 21:44, 19 September 2024 (UTC)[reply]
@AntientNestor, Izno: Turns out mw.text.split() is incredibly slow. Replacing it with a home-grown splitting function made it 20x faster. I've tested it on that James Brudenell page, and the CPU times are now virtually identical between the new and old versions. I'll go ahead and re-implement. --Ahecht (TALK
PAGE
)
00:05, 20 September 2024 (UTC)[reply]
mw.text is probably Unicode sensitive, and I'd guess using lua string is not. Don't know how pertinent that is. Izno (talk) 01:36, 20 September 2024 (UTC)[reply]
@Izno Might be a portability issue on other wikis, but since we're just dealing with numbers and basic mathematical operators there's no reason that any of the data templates should be using non-ASCII characters on enwiki. --Ahecht (TALK
PAGE
)
14:38, 20 September 2024 (UTC)[reply]
Working as before now, thanks. Apologies for diverting your attention from the project-wide issue. AntientNestor (talk) 07:34, 20 September 2024 (UTC)[reply]
I'm giving up on this for now. Even my more efficient implementation is too slow on List of highest-grossing films in the United States and Canada, which takes the use of this template to the extreme. --Ahecht (TALK
PAGE
)
15:43, 20 September 2024 (UTC)[reply]

Template change for Template:Australian_dollar

Please refer to this link: Template_talk:Inflation/AU

Text pasted below for convenience:

Question for you on your recent edit, since I'm not familiar with the inflation template: does the formula account for the fact that 1 pound became $2 upon decimalisation? Aspirex (talk) 12:11, 24 September 2024 (UTC)[reply][reply][reply]

You know what, that is an excellent question! I do recall seeing a vintage video piece about that prior to dollarisation. I assumed it was factored in, because why would I question such a popular Wiki template!
But Wow! Just checked. That is unbelievable! The calculation of £500 in 1940 money says it is $23,813, but I cross-referenced it with the RBA inflation calculator, which specifically addresses the $2:£1 exchange rate. Plugging in the same numbers, I got $47,627.04, which lines up almost perfectly as double the amount!! I think we've found a critical flaw in the conversion process. Man, this is a massive discovery! I'm going to notify people at once and get this looked at. What an incredible discovery. Damn! Electricmaster (talk) 12:22, 24 September 2024 (UTC)[reply]


Credit to Aspirex for bringing this to my attention. Can we please get some people experienced with the inflation template to address our concerns and fix the conversion (which seems like it needs to be done ASAP). Electricmaster (talk) 13:29, 24 September 2024 (UTC)[reply]

This is a known issue with many templates, as the note at the currency conversion section in the documentation specifies (and as is mentioned in the Australia dataset addendum). As of now the best practice would simply be to do the conversion in the article for templates that don't include redenominations. For convenience I've adjusted the template to adjust for the redenomination. Zoozaz1 (talk) 13:48, 25 September 2024 (UTC)[reply]

Template-protected edit request on 30 December 2024

Change | CN = 2019 to | CN = 2023. Zoozaz1 (talk) 03:02, 30 December 2024 (UTC)[reply]

 Done * Pppery * it has begun... 05:04, 30 December 2024 (UTC)[reply]

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)[reply]

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)[reply]

It is easier to understand with an example:

  • {{formatnum:{{Inflation|US|2923706.026|2009|r=3}}}} —> 4,152,233.965 (3 decimal places)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=2}}}} —> 4,152,233.97 (2 decimal places)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=1}}}} —> 4,152,234 (automatic rounding removes the 0)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=0}}}} —> 4,152,234 (whole number)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=-1}}}} —> 4,152,230 (-1 decimal place)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=-2}}}} —> 4,152,200 (-2 decimal place)
  • {{formatnum:{{Inflation|US|2923706.026|2009|r=-3}}}} —> 4,152,000 (-3 decimal place)

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