Template talk:Convert/Archive November 2008

Latest comment: 15 years ago by Jimp in topic Leading zeros


Relative/Absolute Temperature

It seems Convert only provides absolute temperature conversion. This dosen't work when the article references relative temperature differences, though... This section has a good example of that. It lists "10 °C (50 °F) cooler", but it's intended display is "10 °C (18 °F) cooler"

Any chance someone could add that?

Twiek (talk) 15:58, 23 October 2008 (UTC)

{{convert|10|C-change|0}} gives 10 °C (18 °F). CambridgeBayWeather Have a gorilla 20:50, 24 October 2008 (UTC)
Noted. Thanks. - Twiek (talk) 04:04, 3 November 2008 (UTC)

Conversion range for measurements in ft/in?

Does the range functionality not extend to measurements in feet and inches? For example, this:

  • {{convert|2|ft|3|in|to|4|ft|6|in}}

gives this:

Is this something that will be implemented or is it too complex? — Bellhalla (talk) 19:39, 4 November 2008 (UTC)

This might be tricky. I'm not promising anything now. The problem is that the range functionality uses the same extra parameter spaces introduced for the foot-inch, pound-ounce & stone-pound conversions. JIMp talk·cont 18:01, 13 November 2008 (UTC)
It was a "pie in the sky" kind of wish. Don't expend any extra effort trying to implement it. Thanks for all you do, Jimp — Bellhalla (talk) 18:40, 13 November 2008 (UTC)

Number+

Is there a way to have convert use plus values? For an example, if I wish to write:

5+ metres (16+ ft)

could convert allow something like:

  • {{convert|5|+|m|ft}}

Note that this is not the same as plus/minus: 60 ± 10 metres (197 ± 33 ft) --Thorwald (talk) 23:47, 9 November 2008 (UTC)

Doable ... probably not with the code as above but ... I'll put it on the to-do list ... JIMp talk·cont 17:58, 13 November 2008 (UTC)

Disp=br

Jimp, how difficult would it be to implement something like |disp=br or |disp=break, which would simply insert a hard break <br /> between the input and output figures? (e.g., 21,652.4 to 99,463.5 km <br /> (13,454.2 to 61,803.8 mi)) I'm thinking this might be useful in infoboxes, where simple wrapping might not be desired. Not a big deal, just curious. Huntster (t@c) 09:18, 10 November 2008 (UTC)

The code would not be too hard ... shall I regret these words ... but there'll be alot of subtemplates to create ... and "a lot" by Convert standards is alot. JIMp talk·cont 17:56, 13 November 2008 (UTC)
Yeah, I realise that. Looking at all the subtemplates on one screen scares me. If there is some way for me to do the grunt work, I'd be happy to. Otherwise don't worry about it. Huntster (t@c) 23:19, 13 November 2008 (UTC)
When Jimp says a lot he means it. I am currently working on trying to give an align=center option for tables (see below), and I am only 1/7th of the way done. Here is the page with the links to all the different subtemplates in seven categories: Template:Convert/Maintenance/outputs. Your idea, "disp=br", would have to get added to Template:Convert/Maintenance/outputs2. You'll need to create the subtemplate Template:Convert/br first and add it to the "outputs2" in the form of {{Convert/Maintenance/outputs1|d=Dbr|x={{{x|}}}}}. That should generate the hundreds of empty subtemplates needed to do the editing. In the last couple of days I have created many new subtemplates for "tablecen" using the subtemplates of "table" as a guide and filling in the empty subtemplates. Look at my contribs to get an idea. Your case may not be so clear-cut as just using the "brackets" subtemplates as a guide. Jimp will have to advise on the best course there. (hey shouldn't they be called "parenthesis"?; maybe that's an imperial English vs American English thing). Jimp correct me if I'm wrong or there is an easier way.


National Highway Code Length xxx Notice the #'s are centered xxxx Origin
row 1 convert on same line 10002 120.60 km 74.94 mi Phnom Penh
row 2 convert on new line 10001 167.10 km 103.83 mi Phnom Penh
MJCdetroit (yak) 01:58, 14 November 2008 (UTC)

Use in a table advice incorrect?

Use in a table | attach |disp=table Note: For use in tables the template must start on a new line after a pipe. Only the number will be displayed unless you set |abbr=on, |lk=on, |lk=in or |lk=out. Example: here

The above advice is given in Template:Convert/doc in the Parameters section, but appears to contradict the example given. The table in Phnom Penh does not put the template on a new line, and when I try to do so, the text "align=right|" appears. Was this old advice that no longer applies now? Here is an example.

National Highway Code Length Origin
row 1 convert on same line 10002 120.60 km 74.94 mi Phnom Penh
row 2 convert on new line 10001

style="text-align:right;"|167.10 km

103.83 mi Phnom Penh
row 3 convert on same line 10001 167.10 km 103.83 mi Phnom Penh
row 4 10002 120.60 km 74.94 mi Phnom Penh
row 5 convert on new line 10003

style="text-align:right;"|202.00 km

125.52 mi Phnom Penh
row 6 10004 226.00 km 140.43 mi Phnom Penh

-84user (talk) 13:25, 11 November 2008 (UTC)


Try it like this ...

{| class="wikitable"
|-
! National Highway !! Code !!colspan="2"| Length !! Origin
|-
| row 1 convert on same line ||10002
| {{convert|120.60|km|mi|2|abbr=on|disp=table}}||Phnom Penh
|-
| row 2 convert on new line || 10001
| {{convert|167.10|km|mi|2|abbr=on|disp=table}} ||Phnom Penh
|-
| row 3 convert on same line || 10001
| {{convert|167.10|km|mi|2|abbr=on|disp=table}} ||Phnom Penh  
|-
| row 4 ||10002
| {{convert|120.60|km|mi|2|abbr=on|disp=table}}||Phnom Penh 
|-
| row 5 convert on new line ||10003
|{{convert|202.00|km|mi|2|abbr=on|disp=table}} || Phnom Penh
|-
| row 6 ||10004
|{{convert|226.00|km|mi|2|abbr=on|disp=table}}|| Phnom Penh
|-
|}

... and get this ...

National Highway Code Length Origin
row 1 convert on same line 10002 120.60 km 74.94 mi Phnom Penh
row 2 convert on new line 10001 167.10 km 103.83 mi Phnom Penh
row 3 convert on same line 10001 167.10 km 103.83 mi Phnom Penh
row 4 10002 120.60 km 74.94 mi Phnom Penh
row 5 convert on new line 10003 202.00 km 125.52 mi Phnom Penh
row 6 10004 226.00 km 140.43 mi Phnom Penh

... if that's what you're after. JIMp talk·cont 17:53, 13 November 2008 (UTC)

Range for temperatures

Can we get a range for temperatures working? Something like: {{convert|200|to|275|C|F|abbr=on}} → 200 to 275 °C (392 to 527 °F) or {{convert|100|-|200|F|C|abbr=on}} → 100–200 °F (38–93 °C).

Thanks! --Wizard191 (talk) 14:02, 11 November 2008 (UTC)

I'd been meaning to do so but time's got short ... will do when I can. Sorry. JIMp talk·cont 17:54, 13 November 2008 (UTC)

Request for e6acre feet and e6sqft

Please can we have templates for e6acre feet, e6sqft to handle 'million acre feet' and 'million square feet'. Lightmouse (talk) 23:08, 28 October 2008 (UTC)

Here's one, but double check it, because I'm no math wizard...
{{convert|900|e6sqft}}--->900 million square feet (84×10^6 m2)
{{convert|10|e6sqft}}--->10 million square feet (930×10^3 m2)
{{convert|10|e6sqft|m2}}--->10 million square feet (930,000 m2)
MJCdetroit (yak) 04:47, 11 November 2008 (UTC)

Thanks. You and I may not be wizards but Google is. Your arithmetic checks out when I type it into Google. However, I am confused as to the distinction between the latter two. I was not aware that simply adding 'm2' would change the format from 930×10³ to 930,000. I like the option to use 930,000 but it seems like it is a concealed option. Is there a way in which we can make the user interface more explicit? Lightmouse (talk) 11:34, 11 November 2008 (UTC)

Mind if I take a look? JIMp talk·cont 18:02, 13 November 2008 (UTC)
Anyone is always welcome to look--no need to even ask. —MJCdetroit (yak) 02:07, 16 November 2008 (UTC)

Bad grammar and punctuation in this template

"A is 5 miles from B."

is a perfectly good English sentence (unless you doubt that any places are named "A" and "B").

"A is a 5 miles (8 kilometres) long canal."

is not. It should say

"A is a 5-mile (8-kilometre) long canal."

or maybe yet another hyphen should be there:

"A is a 5-mile-long canal."

The example above, saying "A is a 5 miles (8 kilometres) long canal", was produced by this template. Since it was in an article about a canal in France, I thought maybe a foreigner failed to realize that the English language uses the singular form in these sorts of cases (I don't know how it's done in French; I know there are similar phrases in German where the plural is used). Not so. It's the template's fault.

What to do? Michael Hardy (talk) 00:35, 15 November 2008 (UTC)

Try {{convert|5|mi|km|0|adj=on}}. "A is a 5-mile (8 km) long canal." While the parenthetical figure is not hyphened, I don't think this is necessary in this situation. It is impossible for the template to detect when this form should be taken automatically, and really, it shouldn't be required to. Huntster (t@c) 01:24, 15 November 2008 (UTC)
When the units are abbreviated, as are the kilometers in Huntster's example, the Manual of Style (which {{Convert}} follows) suggests the omission of a hyphen, even when used in an adjectival sense. Templates like {{convert}} are here to make an editor's job easier, not make it obsolete. — Bellhalla (talk) 12:36, 15 November 2008 (UTC)
Anyway, this is clearly described in the templates's documentation, so I think Michael just missed it. Chris Cunningham (not at work) - talk 12:37, 15 November 2008 (UTC)

Units should be in symbolic form when in parentheses. So you should never see '(8 kilometres)', it should be '(8 km)'. SI guidelines say that symbolic forms should not have a hyphen. So you should never see '8-km', it should be '8 km'. It is easier if you think of the hyphen as a tool to help understanding, rather than part of spelling. If a reasonable reader can understand the meaning, you don't need to worry. The following have hyphens in various ways that people discuss:

  • "A is a 5-mile (8-kilometre) long canal."
  • "A is a 5-mile (8-km) long canal."
  • "A is a 5-mile-(8-km)-long canal."

But the following is unambiguous to a reasonable reader:

  • "A is a 5 mile (8 km) long canal."

Lightmouse (talk) 12:52, 15 November 2008 (UTC)

"disp=or" and "disp=tablecen"

There are a couple of additional display parameters that I've been working on: |disp=or and |disp=tablecen. I've placed an additional table on the main (doc) page explaining them. They're still under construction, so they may not work in all situations, but they do work in many situations. So, if you find that they work for your situation, then use 'em.—MJCdetroit (yak) 02:20, 16 November 2008 (UTC)

Is translation US gallons per minute to liters per second reasonable?

Would be used for amount of water pumped by fountains, for example. --DAW0001 (talk) 22:04, 4 November 2008 (UTC)

The short answer is yes it is reasonable.
The default unit of volume/time is 'm³/s' and that is used for river flows. In fountains, the values are less than 1 m³/s so people tend to use L/s.
We all need to remember that word-for-word translation is only a guide in languages and it is only a guide in unit systems. For example, fuel economy in many parts of the world is in 'litres per x km' and that would translate word-for-word into 'quarts per y miles'. Lightmouse (talk) 11:53, 5 November 2008 (UTC)
Will do sometime soonish. JIMp talk·cont 17:58, 13 November 2008 (UTC)
Done e.g. {{convert|1000000|USgal/min}} gives "1,000,000 US gallons per minute (63 m3/s)". JIMp talk·cont 09:40, 18 November 2008 (UTC)
It is not merely reasonable; it is almost always the better way to do it. The conventional way to use modern metric units rarely uses the "per minute" option; water flow rates are generally given in liters per second, almost never in liters per minute unless it is someone naively converting gallons per minute.
So, is there some way to get those proper L/s results?
Using {{convert|85|USgal/min|L/s}} gives 85 US gallons per minute (5.4 L/s), so am I just using wrong parameters or isn't that supported?
Gene Nygaard (talk) 04:57, 21 November 2008 (UTC)
Sample of new conversion in use (USGal per minutes to cubic meters, not liters, per second) is Buckingham Fountain. Thanks. --DAW0001 (talk) 12:34, 21 November 2008 (UTC)

Leading zeros

What's with the lack of leading zeros in front of numbers less than one? Didn't this handle that before? Has it been changed? Or has that been a problem all along, and I haven't noticed it.

Let's get rid of nonsense like this:

.85 inches (22 mm)

Gene Nygaard (talk) 04:36, 21 November 2008 (UTC)

Nothing's been changed: as always we're relying on editors to add the zero themselves (i.e.{{convert|0.85|in|mm}} not {{convert|.85|in|mm}}) just as we're relying on them not to try converting yards to kilograms. Is this causing trouble which needs attention or is it potential trouble? JIMp talk·cont 20:46, 21 November 2008 (UTC)
When I tried to do something, not that example, I couldn't get the zero in there in the first place, even if I put it into the template. I had actually tried to put a 0 in the template, and it had no effect. Guess I'll have to try to figure out what that was.
However, if this is going to be something that you "rely on editors to add ... themselves", that fact needs to be documented somewhere, in the instructions to those editors. They not only need to be told what happens if they don't do it, and they need to be told how they can accomplish that desired result. But is it documented? No. I don't see one little peep about it on the documentation page.
Furthermore, you are not only relying on them "not to convert yards to kilograms". You are also relying on them not to convert ounces to milliliters (a quite reasonable expectation; this is something which is at least mentioned in the documentation), and you are relying on them not to convert pounds to kilograms when they should go to newtons, not to convert nautical miles as if they were statute miles, not to convert temperature differences as if they were temperature readings, etc. Most of that reliance is ill-founded, however—the users are given any instructions notifying them that this responsibility is being placed on them. Gene Nygaard (talk) 21:09, 21 November 2008 (UTC)

I don't know what went wrong with your leading zero, that sounds strange. More warning on the doc page not to convert apples to oranges (where there could be a real possibility of confusion) is a fair call. JIMp talk·cont

The other problem with that example

Which reminds me of the other problems with that example:

  1. Why doesn't it handle singular properly? It should give the result as
    0.85 inch (22 mm)
  2. Why do we still have a parameter "sing=on" which doesn't give us singular results, but instead gives us the adjective forms, with all those hyphens thrown in? Gene Nygaard (talk) 04:39, 21 November 2008 (UTC)
  1. If we should have "0.85 inch", we could. However, isn't it supposed to be "0.85 inches"? I'd always thought it was the latter. I spoke to a friend of mine who is a bit of grammar buff & he agreed. Of course, I don't want to impose my way on WP ... no, I'm no evil genius (or idiot as the case may be) weilding power over Wikipedia (for some reason unfathomable). Shall we not take the question to MOS?
  2. We don't need sing=on a bot could go and change it to adj=on.
JIMp talk·cont 20:46, 21 November 2008 (UTC)
From my experience plural units for decimal quantities is pretty standard. — Bellhalla (talk)
I agree. "five tenths of an inch" is "zero point five inches". No idea why.—Kww(talk) 20:58, 21 November 2008 (UTC)
No, it isn't standard. As you point out, "of an inch" not inches. We don't say "I swam a half miles" or whatever. Adding it when speaking in your example is like putting the plural with the "five"; that doesn't mean it should be there in written form.
The standard rules are that, in a quirk of the English language, zero takes the plural. But otherwise, anything with an absolute value is less than or equal to one is singular.
x = 0 plural
0 < |x | ≤ 1 singular
|x | > 1 plural
This provides additional, visible reinforcement to the fact that this is a fractional quantity. And that is especially useful when editors have no way of knowing what hoops they need to jump through to get a leading zero in front of a number less than one. Gene Nygaard (talk) 21:59, 21 November 2008 (UTC)
It sounds like there are two ways to approach quantities between 0 and 1. For fractions (e.g. ⅓ or ⅜) one should properly use a singular unit ("⅓ of an inch" or "⅜ of a gallon"). But for decimal quantities my experience is that plural units are used ("I swam 0.5 [read as: zero-point-five] miles"). — Bellhalla (talk) 22:30, 21 November 2008 (UTC)
There is a third possible distinction, too; numbers expressed in scientific notation could be distinguished, but they are not often used with spelled-out words rather than with symbols so its hard to even gauge usage. I will agree that you do see people using the plural form with decimal fractions, as well as the singular form. However, while I have seen several places stating the rule as I have stated it, I haven't seen any authoritative guides expressing a contrary rule. Do you have any? Most general guidelines don't even seem to recognize the fact that we have real numbers as well as counting numbers. Maybe the guidelines of some professional or standards organization? Gene Nygaard (talk) 15:00, 22 November 2008 (UTC)

My feeling is the same as Bellhalla's: it's plural for all decimals but fractions are completely different. I make no claim to be a grammarian of any sort but "0.45 kilogram" seems distinctly off to my ear ... could it be a dialect thing? Of course, I could be wrong. How the template handles this can be changed & I'm not so stubborn as to get in the way of that change if consensus is for the change. However, whilst I believe you, Gene, to be quite knowledgeable on a good number of things and will generally take your word on many of them, this just seems so far from being right that I'd rather see a broader consensus (i.e. at least a discussion at WT:MOSNUM) before the template coding is modified. JIMp talk·cont 11:06, 22 November 2008 (UTC)

I used to have some good references on this, seem to have difficulty finding it now. There are oodles of examples of people properly using singular with decimal fractions less than one, however, on Wikipedia and off.
One thing that is absolutely certain is that -1 is singular, and the convert template clearly doesn't handle that properly, either. Gene Nygaard (talk) 14:46, 22 November 2008 (UTC)
Note also that choosing to do it wrong is every bit as much a decision made without "broad concensus" as choosing to do it right would be. We don't have any way of knowing how many times this wrong choice of yours has already changed the usage here on Wikipedia, so we? Gene Nygaard (talk) 07:04, 23 November 2008 (UTC)
OTOH, if "sing=on" actually worked, not as a synonym for "adj=on", then at least you wouldn't be completely deciding the issue, and we'd be able to do it properly if we chose to do so. You already have the parameter; just put it to its proper use, if you won't fix it to automatically put in the singular forms. Then, at least, the select few who can edit this template don't dictate Wikipedia usage all on their own. Gene Nygaard (talk) 08:04, 23 November 2008 (UTC)

No, it doesn't handle minus one properly (nor does the template convert the hyphen to a minus sign). I never thought there'd be the need. There are negative temperatures but degree(s) is never spelt out by the template anyway. Other than that I'd imagine that they'd be so rare that it would be easier just it fix any minus ones by hand. I walked −1 furlong (−660 ft; −200 m) north ... yeah, I mean 1 furlong south. I'd rather put a note up advising people not to try negatives of anything but temperature.

No, broad consensus on whether we should write grammatically correctly or not is not what I'm aiming at. Of course we should. I'd like to see consensus on the status of the said rule. If this is the rule, surely refs can't be too hard to find. Or is it a rule in the same basket as "Split not the infinitive." or "End not a sentence with a preposition."? Not that I don't trust you, 0.5 metre just doesn't feel right ... maybe it's just me. JIMp talk·cont 11:02, 26 November 2008 (UTC)

Definitely not just you. I've neither heard or seen decimals 0>x>1 as anything other than pluralised. As far as I am aware, "1" and "-1" are the only instances where a number (whole or otherwise) is singular. Of course, as pointed out above, fractions are handled differently. Huntster (t@c) 21:03, 26 November 2008 (UTC)
If it is the same mathematical number, why should it be a different grammatical number? Surely that is part of the reasoning of those who have stated the rule.
Note further that
  • {{convert|11/16|in|mm}} gives us 1116 inch (17 mm)
An -es ending, for a common fraction less than one. So even if your guess at the rules were correct, convert doesn't handle them properly according to that guess. Then, on top of it, it gives us that number with weird precision, just when we've come to expect the convert template to give us a reasonable first approximation of the desired precision even if we don't explicitly prescribe the precision.
Why aren't degrees ever spelled out? They sometimes should be; they often are in articles which don't use the convert template. So why doesn't convert handle them?
Negative numbers can be and are used, for example, with anything that are vectors. That includes, of course, velocity and acceleration; deceleration is nothing but negative acceleration. It includes force; if you are talking about the forces due to gravity, and those forces opposing it, a simple + and - sign are enough to indicate direction (see, e.g., Tension (physics): "Assume up is positive and down is negative.") But this is what we get, if we try to use convert:
  • {{convert|-1|ft/s}} gives −1 foot per second (−0.30 m/s)
    • {{convert|-1|ft/s|sing=on}} gives −1-foot-per-second (−0.30 m/s) with inappropriate hyphens and different minus signs in the two parts
  • {{convert|-1|N|lbf}} gives −1 newton (−0.22 lbf)
    • {{convert|-1|N|ozf|sing=on}} gives −1-newton (−3.6 ozf)
Angles are, of course, also positive and negative--look at some of the artillery or surveying or astronomy articles. But convert isn't robust enough to convert angles, is it? It's so damn hard to figure out what it can and cannot do; nobody is ever really sure, I don't think. Just try it and see if you get redlinks or error messages, and if not blindly assume that it is correct. Never mind if you are wrong--you can just blame it on the template if you are. I guess that's the philosophy we are supposed to follow.
In chemistry, energies can be positive and negative--depending on whether you need to add energy to make a reaction work, or the reaction gives off energy. Convert does try to handle energy conversions.
I'm sure there are lots of other examples as well. And many of them are a whole lot more likely to appear in Wikipedia than a lot of the arcane trivia which the convert template will handle, things which nobody in their right minds would ever actually use on Wikipedia. There are others that would never appear outside one or two articles dealing with the definitions of units--and there is no good reason to complicate this template to handle them either. Gene Nygaard (talk) 23:03, 26 November 2008 (UTC)

On the contrary, why should the same rule be applied to fractions as to decimals? Language ain't bound by no mathematical rule. Surely those who go around stating rules about English grammar these days first listen to those who speak the language rather than simply extrapolate rules from a different case albeit one in which we have the same number. Language is more complex than that: why expect grammatical number to be a function of mathematical number?

Besides, we don't say "I walked half kilometre." we say "I walked half a kilometre." The "a" is one thus the singular. We don't say "¾ inch" we say "¾ of an inch". We might say "point five of a metre." but that's 0.5 of a metre. Leave the "of an" out and and we've got a different beast.

The template is not set up to handle fractions (except in a very limited way). Should this go on the to-do list?

Degrees weren't spelt out in the original convert. I stuck with that. Sometimes they should be, fair enough, mostly the needn't be. Need something be done?

The vector, yes, I've heard of it (note the example I gave above about walking minus one furlong North). Of course, we can have negatives but do we often need to convert them on Wikipedia? If so, the template could be up graded.

No, the template can't do angles but can a bunch of trivial stuff. I don't see too much harm in keeping the trivial stuff but a tidy up might have some value. Adding angles would not be hard but would a conversion between radians and degrees be much use?

JIMp talk·cont 09:56, 28 November 2008 (UTC)