Jump to content

Template talk:Format price

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Thousands

[edit]

Replacing something like "$34,500,000,000" with "$34.5 billion" is excellent and greatly improves readability of prices in text. However, I don't think that the template should apply the transformation "$12,300" --> "$12.3 thousand". People say "thirty-four point five billion" but I've never heard anyone say "twelve point three thousand" rather than "twelve thousand, three hundred". Dricherby (talk) 11:22, 11 May 2009 (UTC)[reply]

I agree totally. $12.3 thousand is stupid - we expect to see $12000 in these cases. 91.106.172.248 (talk) 10:04, 11 August 2009 (UTC)[reply]

I agree as well. The man responsible is User:Alexander_Gieg and so I've asked him to change it. I got here from Thomas Jefferson, where I learned that his estate was sold "to James T. Barclay for $7,000, equivalent to $143 thousand today." My first thought was $143? That's nothing!. A hundred and forty-three dollars thousand? And I can't change it because the figure is provided by an inflation calculator which otherwise pumps out $143000, which looks like arse. -Ashley Pomeroy (talk) 22:51, 19 November 2010 (UTC)[reply]

Until someone fixes this ugly template, try using the formatnum: "magic word" in place of the formatprice| template. Note the change from | to :, which is necessary. Rupert Clayton (talk) 03:55, 29 March 2011 (UTC)[reply]
Came here to agree with this. Thousands with a decimal place makes no sense whatsoever. Never seen this before. --206.188.26.36 (talk) 20:03, 8 November 2016 (UTC)[reply]
I have fiddled with the sandbox, but I'm not sure what the exact design criteria are here. Please take a look at Template:Format price/testcases and provide feedback on the "thousands" rendering. – Jonesey95 (talk) 03:14, 20 May 2021 (UTC)[reply]
Jonesey95, the sandbox looks like it's behaving exactly as I'd hope; thanks for the fiddling, and I hope we can implement! {{u|Sdkb}}talk 08:14, 20 May 2021 (UTC)[reply]
OK, I have updated the code in the live template. There are still some quirks, as can be seen on the testcases page, but I think this is an improvement that did not make anything worse. – Jonesey95 (talk) 13:12, 20 May 2021 (UTC)[reply]

Decimals and commas

[edit]

Some currencies use the comma for sub-units, like where the decimal is used in USD. In fact, I think it is a standard European thing. Does this template handle that? Int21h (talk) 06:04, 15 April 2010 (UTC)[reply]

Again on fixing thousands

[edit]

I believe that the simple solution is to change the template to treat it like every number up to hundreds, including the option to have it show a variable number of decimal points as seen on the template page list of examples for numbers up to the hundreds. I don't know enough to even begin to test this or work on a fix that could be proposed, nor would I trust someone responding to an edit request template to do it so if someone who knows enough about this template to fix it runs across this please consider implementing this change. Cat-fivetc ---- 02:37, 16 December 2012 (UTC)[reply]

Bug fix

[edit]

Please update this template with the code in the sandbox {{Format_price/sandbox}} (i.e this version).

At the moment there's a problem:

Looking at the template logic, this is because

{{#expr:(8.2*100 mod 10)}} is 9 whereas (i.e. 9) {{#expr:(820 mod 10)}} is 0 (i.e. 0). i.e. 8.2 * 100 != 820.

I have a solution in the sandbox that solves this problem by wrapping (n round 01) around the multiplies, so that n * 100 is always an integer. I have set up testcases at {{Format_price/testcases}}. Edgepedia (talk) 10:27, 28 September 2013 (UTC)[reply]

Sorry folks. Amazingly (n round 0) worked, but of course this should be (n round 1). Sandbox updated. Edgepedia (talk) 10:36, 28 September 2013 (UTC)[reply]
Done --Redrose64 (talk) 13:41, 28 September 2013 (UTC)[reply]

Three zeroes, not "thousands"

[edit]

On The Tower House, £{{Formatprice|{{Inflation|UK|75000|1970|{{CURRENTYEAR}}|r=0}}} is displaying as "£982 thousand", which is a format rarely used in British English. How can it be made to display as "£982,000", which is more normal? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 22:34, 29 December 2013 (UTC)[reply]

You can achieve this with the template "formatnum" as recommended above. But unlike "Formatprice", "formatnum" does not support rounding. (Well, maybe it does, but I can't find its documentation.) Maproom (talk) 08:08, 17 March 2015 (UTC)[reply]

Thousandths

[edit]

Please add a way to specify thousandths, for gasoline prices, e.g. $3.279. --Traal (talk) 01:18, 24 January 2014 (UTC)[reply]

Formatting options

[edit]

This template combined with template:inflation is great for keeping pages automatically updated. I used it for a history of top tax brackets table. Instead of it showing up as "$12 million" like it currently does in the top field, I'd like it to show:

  • A given number of decimal places. Instead of showing 12, or 12.1, or 12.13, you could force it to always show a certain number. Digits doesn't do this.
  • An abbreviation of thousand, million, or billion. It'd like it to be "12k", "12M" or "12B".

Is it possible to add those as options to this template? gren グレン 20:58, 27 November 2015 (UTC)[reply]

Needy

[edit]

This village pump discussion shows some need here. As of Feb 3, 2016 it's used on 2410 pages, and part of two wikiprojects, but it is not maintained, and has fewer than 30 watchers. Perhaps unprotecting the page would get someone interested. — CpiralCpiral 06:01, 4 February 2016 (UTC)[reply]

abbreviations

[edit]

Please could this template be updated to allow abbreviations (m for million, bn for billion, etc) to be optionally specified. Thryduulf (talk) 11:39, 29 November 2017 (UTC)[reply]

Format price broken for certain large numbers

[edit]

Format price with large numbers seems broken and results in default case of NaN. Seen on net worth of https://en.wikipedia.org/wiki/John_D._Rockefeller and format price subheading of this page https://en.wikipedia.org/wiki/Template:Inflation.

Examples: US$498 billion $301 trillion Jiesiren (talk) 20:30, 22 October 2019 (UTC)[reply]

This was a side effect of me trying to fix a bug in {{Inflation}}. I have reverted that change, so this template should work fine now when wrapped around {{Inflation}}. I'll keep experimenting. – Jonesey95 (talk) 20:59, 22 October 2019 (UTC)[reply]
@Jonesey95: or to anybody else, am I to understand that this is still broken? For optimal formatting of inflation calculation, where we leap three orders of magnitude, I set it in the lead section of Great Flood of 1951 which turns "$935 million" into "$11 billion", but it doesn't work in Crystal Pepsi which turns "$474 million" into "$1000 million" instead of into "$1 billion". Is that just a flaw of formatprice so that I must use something else? Thanks a lot for your work on this tricky stuff! — Smuckola(talk) 08:27, 4 July 2024 (UTC)[reply]

Large unit clarification

[edit]

I would like to be able to display a clarification for large units like billion, trillion, etc. Trigenibinion (talk) 16:52, 31 December 2020 (UTC)[reply]

Add () around {{{1}}} at the division points

[edit]

Could you surround {{{1}}} with brackets: ({{{1}}}) at the division points: ({{{1}}}) / 1e+...? Otherwise it may parse incorrectly more complicated expression like those (of course you can always add the brackets yourself when calling formatprice, but in some cases it may not be so obvious):

Without brackets: 167 billion

With (manual) brackets: 167 billion MarMi wiki (talk) 14:43, 31 May 2021 (UTC)[reply]

 Done. – Jonesey95 (talk) 15:45, 31 May 2021 (UTC)[reply]