Template talk:Format price
This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||
|
Thousands
editReplacing 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)
- 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)
- 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)
- 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)
- 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)
- 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)
Decimals and commas
editSome 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
editI 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)
Bug fix
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please update this template with the code in the sandbox {{Format_price/sandbox}}
(i.e this version).
At the moment there's a problem:
{{Format price|8.1}}
gives 8.10 (i.e 2 d.p.){{Format price|8.2}}
gives 8.20 (i.e. with 1 d.p.)
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)
- 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)
- Done --Redrose64 (talk) 13:41, 28 September 2013 (UTC)
Three zeroes, not "thousands"
editOn 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)
- 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
editPlease add a way to specify thousandths, for gasoline prices, e.g. $3.279. --Traal (talk) 01:18, 24 January 2014 (UTC)
Formatting options
editThis 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
editThis village pump discussion shows some need here. As of Feb 3, 2016[update] 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)
abbreviations
editPlease 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
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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)
- 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)
- @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)
Large unit clarification
editI 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 {{{1}}} at the division points
editCould 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)
- Done. – Jonesey95 (talk) 15:45, 31 May 2021 (UTC)