Template talk:Format price

Thousands
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)


 * 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)

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)


 * 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)


 * 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)

Notified: Wikipedia talk:WikiProject Templates. &#123;{u&#124; Sdkb }&#125;  talk 00:00, 20 May 2021 (UTC)


 * 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)
 * , the sandbox looks like it's behaving exactly as I'd hope; thanks for the fiddling, and I hope we can implement! &#123;{u&#124; Sdkb  }&#125;  talk 08:14, 20 May 2021 (UTC)
 * 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)

Decimals and commas
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)

Again on fixing thousands
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-five t  c   02:37, 16 December 2012 (UTC)

Bug fix
Please update this template with the code in the sandbox (i.e [//en.wikipedia.org/w/index.php?title=Template:Format_price/sandbox&oldid=574855269 this version]).

At the moment there's a problem:


 * gives (i.e 2 d.p.)
 * gives (i.e. with 1 d.p.)

Looking at the template logic, this is because

is whereas (i.e. 9)  is  (i.e. 0). i.e. 8.2 * 100 != 820.

I have a solution in the sandbox that solves this problem by wrapping (n round 0 1) around the multiplies, so that n * 100 is always an integer. I have set up testcases at. Edgepedia (talk) 10:27, 28 September 2013 (UTC)
 * 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)
 * Yes check.svg Done -- Red rose64 (talk) 13:41, 28 September 2013 (UTC)

Three zeroes, not "thousands"
On The Tower House,  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)


 * 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)

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

Formatting options
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)

Needy
This village pump discussion shows some need here. it's used on, and part of two wikiprojects, but it is not maintained, and has fewer than 30 watchers. Perhaps unprotecting the page would get someone interested. &mdash; Cp i r al  Cpiral  06:01, 4 February 2016 (UTC)

abbreviations
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)

Format price broken for certain large numbers
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$ $ Jiesiren (talk) 20:30, 22 October 2019 (UTC)
 * 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)


 * 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)

Large unit clarification
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)

Add around at the division points
Could you surround with brackets:  at the division points:  / 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:

With (manual) brackets: MarMi wiki (talk) 14:43, 31 May 2021 (UTC)
 * ✅. – Jonesey95 (talk) 15:45, 31 May 2021 (UTC)