Template talk:Convert/Archive December 2018

Latest comment: 5 years ago by DePiep in topic Wikidata and units


Lakh and crore

India-related articles frequently use the lakh and crore units, especially to count people and money. I was surprised that {{convert}} does not seem to support those. It would be useful to provide conversions such as:

  • {{convert|21|lakh}} people → "21 lakh (2.1 million) people"
  • {{convert|35|crore}} rupees → "35 crore (350 million) rupees"

We already have monetary conversion of rupees with {{INRConvert}}, but a separate conversion of lakh and crore without switching to USD would be useful. — JFG talk 12:10, 8 December 2018 (UTC)

See MOS:NUMERAL and the links to {{lakh}} and {{crore}}. Martin of Sheffield (talk) 12:16, 8 December 2018 (UTC)

e6 & abbr=unit without abbreviations?

I was working on the page Oil futures drunk-trading incident and wanted to change the section "an employee of London-based PVM Oil Futures traded 7,000,000 barrels (1,100,000 m3) of oil worth approximately US$520 million while drunk" to "7 million bbl (1.1 million m3)" (with abbr=unit) but without the unit output being abbreviated i.e. "million barrels" instead of "million bbl". Is there an option to do so? There are other articles where I would have used "5 million miles" instead of "5 million mi".-Ich (talk) 23:41, 11 December 2018 (UTC)

I cannot help you, but by far, this is the most wonderful topic I've met on this talkpage in 6 years: the Oil futures drunk-trading incident (having conversion issues). -DePiep (talk) 23:57, 11 December 2018 (UTC)
To me, the article seems to be about:
- "He [Perkins] traded x barrels at y US$/barrel while drunk".
- Missing is:, like: "... while price was q $/barrel". Then calc the diff. How difficult can it be?
-DePiep (talk) 00:12, 12 December 2018 (UTC)
No. I'm afraid the only relevant options are abbr=off which gives "million units" for input and output, or abbr=on which uses the irritating "×10^6" for input and output, or abbr=unit which gives "million symbols" for input and output.
A workaround, if the problem was widespread, would be to create a new unit such as "barrels" which is never abbreviated. I agree that "5 million mi" is pretty awful and the solution there might be to change unit "miles" (which is currently equivalent to "mi") to never be abbreviated.
Or, if someone can think of a short, useful option like abbr=unit that could be implemented. Values for abbr include in/out/on/off/unit/values. The trick would be to think of a new word that made sense. Johnuniq (talk) 00:27, 12 December 2018 (UTC)
@Johnuniq: Thanks - I actually didn't know abbr=off would give "7 million barrels (1.1 million cubic meters)" which is pretty much what I wanted (avoiding the 10^6). I have updated the trading page accordingly. (For what it's worth, I think this should be the default output for e6 instead of using scientific notation). Thanks again for your help.-Ich (talk) 23:09, 13 December 2018 (UTC)
P.S. I updated the documentation here.-Ich (talk) 23:26, 13 December 2018 (UTC)
That looks good, thanks. Johnuniq (talk) 02:20, 14 December 2018 (UTC)

Remnant: disp=flip

I notice a FAQ linked to via the redirect Template:Convert/FAQ that recommends the deprecated |disp=flip. Should this be updated to |order=flip? —Quondum 03:23, 14 December 2018 (UTC)

Thanks, I had forgotten about that page. Maybe pruning would be best? Perhaps keep the questions/topics but replace the answers with a link to the section in the doc? Some short answers might be worth keeping. Johnuniq (talk) 04:35, 14 December 2018 (UTC)
Not much links to the FAQ – the only one of significance seems to be at the top of this talk page. It gets viewed less than once per fortnight. The template documentation page has far more comprehensive detail. It creates extra maintenance, and is easily allowed to become out of date. I suggest pruning it. You may wish to glance over it to see whether there is anything feel worth merging into the template doc page, but much of the information is already there. —Quondum 01:14, 15 December 2018 (UTC)
OK I have started working on a copy of the wikitext in a local file. I'm hoping no one will edit the FAQ for a while until I'm done. Johnuniq (talk) 02:46, 15 December 2018 (UTC)
I have finished. Johnuniq (talk) 04:40, 15 December 2018 (UTC)

e6C, e6F

These would be useful. Thanks! Lfstevens (talk) 19:35, 1 December 2018 (UTC)

e6 does not work with C because of the awkward offset issue (0 °C = 32 °F) so simple scaling might be inaccurate. When dealing with e6C you probably don't care about the offset in which case the following workaround is available:
  • {{convert|12|e6C-change|e6F-change|abbr=unit}} → 12 million °C (22 million °F)
Johnuniq (talk) 00:15, 2 December 2018 (UTC)
Thanks. Lfstevens (talk) 04:25, 20 December 2018 (UTC)

"Error in convert: cannot convert "energy/area/time" to "power/area""

I tried to do

{{Convert|5.5|kWh/m2/day|W/m2|abbr=on}}

and got this error message today.

5.5 kWh/m2/d ([convert: unit mismatch]). Should we try to fix this? --Daviddwd (talk) 07:22, 27 December 2018 (UTC)

I don't think so. Convert does some magic in its attempt to work with automatic "per" units but figuring out that kWh/m2/day is equivalent to power/area is above what can be expected IMHO. My guess is that converts like that would be rare and some kludge to workaround the issue would be sufficient. I am impressed that convert appears to get this right:
  • {{convert|5.5|kWh/day/m2|W/m2|abbr=on}} → 5.5 kWh/d/m2 (230 W/m2)
Johnuniq (talk) 09:27, 27 December 2018 (UTC)
Since kWh is power.time, and you're dividing by time on the left, that can be factored out: 0.22916666666667 kW/m2 (229.16666666667 W/m2) --Redrose64 🌹 (talk) 11:13, 27 December 2018 (UTC)
It looks like convert can't tell the difference between (kWh/m2)/day (where the time units cancel each other) and kWh/(m2/day) (where the time units multiply).  Stepho  talk  17:55, 27 December 2018 (UTC)
And correctly so {{Convert}} cannot. Input kWh/day/m2 is ambiguous (because: brackets=priorities missing, as pointed out by User:Stepho-wrs). -DePiep (talk) 22:09, 27 December 2018 (UTC)

Miles, furlongs, yards, and generally adding stuff

{{convert|1|mi|4|furlong|m}} works great, yielding
1 mile 4 furlongs (2,400 m), whereas
{{convert|1|mi|4|furlong|10|yd|m}} returns
1 mile 4 furlongs (2.4140160000 km)*

So i try a {{convert|1|m|2|cm|3|mm|ft}}, but that too fails:
1 metre (3 ft 3.37 in)*

But thanks for an otherwise fantastic template. —Jerome Potts (talk) 08:55, 30 December 2018 (UTC)

Assuming you want two different units output (note the spaced list of two):
{{convert|1|mi|4|furlong|yard m}} →
1 mile 4 furlongs (2,600 yd; 2,400 m)
— Preceding unsigned comment added by DePiep (talkcontribs) 09:26, 30 December 2018 (UTC)
The OP wants 1 mile + 4 furlongs + 10 yards. As noted, that does not work and the 10 is misinterpreted as the precision, while holding the cursor over the asterisk (or previewing an edit of this section) shows that "yd" is ignored. That combination has not been added because no one has yet needed it. Is it needed more than once or twice? Where? It is possible to do what is asked with chains:
  • {{convert|1|mi|4|ch|10|yd|m}} → 1 mile 4 chains 10 yards (1,699 m)
Johnuniq (talk) 09:51, 30 December 2018 (UTC)
Right, Johnuniq. Apparently some known combinations are encoded in the template logic ; i am suggesting that those be done with by replacing them with the possibility to simply add stuff. Of course, the "stuffs" would have to be compatible with one-another, say by category/class: linear, area, volume, weight, etc. —Jerome Potts (talk) 10:36, 30 December 2018 (UTC)
…meanwhile, since a furlong is 10 chains, is it possible to have it compute with chains in the background, while talking furlongs ? —Jerome Potts (talk) 10:44, 30 December 2018 (UTC)
@Jerome Charles Potts: The modules underlying the {{convert}} template are hugely complex. We only add functionality when there is an established need to do so. Johnuniq has already asked "Is it needed more than once or twice? Where?", which I shall amplify by asking: please give examples of articles where this proposed new feature would be useful; please also indicate why the existing functionality is not adequate for those cases. --Redrose64 🌹 (talk) 19:33, 30 December 2018 (UTC)
I was enhancing the Derby (horse race) article to use this template, and have since found an okay solution with multiple {{convert}} invocations ; at the moment i do not have other articles to mention here, and in the future i will likely have forgotten about that one, as i tend to do drive-by editing and i don't keep tabs. I was just asking, and am not too surprised by your replies, as it is obvious that managing such an elaborate functionality is a complex endeavour. Didn't i say that i was suggesting ? For what it's worth, my thinking is that if there are a bunch of "known/usual combinations" hard-coded or kept in a table somewhere for the code to look up, then the code is likely to be inflated and quite complicated, in which case a loop that grabs arguments, converts them to the standard international unit of their class, adds them up ; followed by code that converts that sum to the requested output, might be somewhat lighter, therefore easier to maintain. Apparently this is not generating immediate enthusiasm, which, again, i can understand. Also, it occurs to me that that could be opening the door to requests for other arithmetic operations, complicating further the managing of this template's parameters. —Jerome Potts (talk) 21:26, 30 December 2018 (UTC)
The table defining which combinations of units work together is here. It is easy to add stuff but as Redrose64 mentioned, adding everything that might be useful is resisted. Johnuniq (talk) 22:57, 30 December 2018 (UTC)

Wikidata and units

Wikidata property unit symbol (P5061) says it is an "abbreviation" of the unit name, and it must have 'language' specified. I started this. I think this sets back any WD conversion system some 2+12 years. -DePiep (talk) 13:48, 19 December 2018 (UTC)

(postpone archiving) -DePiep (talk) 23:34, 30 December 2018 (UTC)