Template talk:Convert/Archive July 2011


disp=x and default out_units

It looks as though using the disp=x option currently kills the ability to skip the default out_unit value. For example: {{Convert|67|kg|disp=x| [|]}} causes:

67 kilograms][convert: unknown unit]

But {{Convert|67|kg|lb|disp=x| [|]}} works fine: 67 kilograms [148 lb].

I think that should be fixed, since it's nice being able to skip the obvious out_unit values when we're able to do so. It's fairly common to use {{convert|67|kg}}, which provides 67 kilograms (148 lb), for example. ps.: What's up with the apparent requirement to use a leading space for the opening disp character? Regards,
— V = IR (Talk • Contribs) 00:24, 25 June 2011 (UTC)

  • Use 0 to get the default output-unit: To allow skipping the output-unit parameter, with disp=x, means that parameter 3 would need to be inserted (as "0"); otherwise, there is no easy way to check to see when parameter 3 has been omitted, where the brackets "[|]" are parameters 3 & 4. For that reason, the user must set parameter 3 as "0" to have the output-unit default:
· {{Convert|67|kg|disp=x| [|]}} → 67 kilograms][convert: unknown unit]
· {{Convert|67|kg|0|disp=x| [|]}} → 67 kilograms [148 lb]
However, when "0" is passed as parameter 3, it is also interpreted as "round to 0 decimals" so the result is "148" rather than the 2-significant-digit "150". Where brackets are needed, we have the rare, limited option disp=br to show "[ ]" so then disp=x is not needed to show brackets, and the output-unit can default without rounding to 0 precision, where the result remains as 150:
· {{Convert|67|kg|disp=br}} → 67 kilograms
148 pounds
In general, there are several ways where Convert tries to spot common mistakes in parameters, but with disp=x, the mistakes are very difficult to pinpoint, due to the unlabelled round-level parameter (as in "|0") causing confusion in parameter placement. More about this later. -Wikid77 04:37, 4 July 2011 (UTC)
Excellent. Thank you!
— V = IR (Talk • Contribs) 12:04, 4 July 2011 (UTC)

Which template for horse height conversion?

Following the laborious fixing of the Convert template for hands (horse height), for which many thanks again to everyone, I've been using it and it is good. Some others are using a template called Hands, which is relatively inflexible. In case anyone is interested, I've started a discussion on their relative merits at Wikipedia talk:WikiProject Equine#Which template.
Justlettersandnumbers (talk) 23:59, 29 June 2011 (UTC)

  • I favor having at least 2 templates for unusual conversions, to allow wide-open expansion to support real-world specialties. Some of the equine editors say that, not only are hands decimals in base 4 (where .1, .2, .3 gets followed by 1.0 not 0.4), but there is only 1 decimal digit allowed. So, "14.15 hands" is not standard, whereas "14.1 12" would be used instead, but almost no where else in measurements. There are so many unusual options for horse height, that I am willing to edit Template:Hands to allow the special options which would clog Convert with "used-no-where-else" options to stop decimals from having more than 1 digit. In general, having at least 2 templates, for a mainstream issue, allows easy expansion through the 2 different templates, as 2 different routes to expand. I did this with musical album tracks, with a 2nd template that could add the track lengths of all songs on an album (total time), but that template was axed as a "non-standard" fork of THE ONE ALLOWED template for album tracks. Instead, I would allow a 2nd customizable album template, such as having a track-sort option, to allow sight-impaired readers to read song titles in alpha order, expecting "Zombie Dance" to be listed near the end. Having a 2nd, specialized template, for each mainstream concern, allows Wikipedia to add features within days, rather than the current delay for new template features, which is: years. More later. -Wikid77 01:21, 4 July 2011 (UTC)
Sound a fair solution. JIMp talk·cont 01:27, 4 July 2011 (UTC)

Converting BTU to watts

I added the convert template for btu but it was reverted. The edit summary was:

I'm always surprised by claims of what non-metric units do and don't mean. I think the best solution is to have a template for 'btu/h' but if that isn't acceptable, we need a way of converting 'btu' into watts. Yuck! Can somebody have a go at getting metric units into articles like that? Lightmouse (talk) 20:28, 2 July 2011 (UTC)

I think the problem is mainly with Solar air conditioning. I would question whether it is helpful to use BTU, a unit that is probably by now unfamiliar to most English speakers, in the article at all. If it is felt desirable to use it, then the usage should be precise. The BTU is a unit of energy. It may be used colloquially in the heating/ventilating industry (and confusingly for everyone else) as a shorthand for BTU per hour, a unit of power. We should be more encyclopedic: if the article must, it should use BTU/h as a unit of power (or power rating). Template:Convert could then be be used, if BTU/h is supported, (which is not clear as Template:Convert/list of units/power surprisingly does not exist) to provide a conversion to kW. I would prefer to see the article use SI throughout anyway. Globbet (talk) 22:10, 2 July 2011 (UTC)
This is the problem with blind adherence to the principle of following the sources (c.f. MOSNUM). It's ugly out there but I don't think it's too much to ask that we keep WP a little sane. We have to find the balance between internal consistency and consistency with the particular fields in question. If the US heating/ventilating industry (Yes, who else but Americans, on offence, would use BTUs in the first place?) want to drop the "per hour" part of the unit, let them but let us not confuse our readers by following the practice. It's interesting that whilst the claim is that "BTU" entails a power rating the link goes to the BTU article which makes it clear that the BTU is a unit of energy. If it's BTU/h, use BTU/h (the subtemplate exists by the way, just capitalise "BTU"). JIMp talk·cont 00:27, 4 July 2011 (UTC)

Thanks. I'll apply 'BTU/h'. I tried 'btu/h' initially, can we have options for that and 'Btu/h'? Lightmouse (talk) 05:48, 4 July 2011 (UTC)

Sure, why not? JIMp talk·cont 06:04, 4 July 2011 (UTC)

Can somebody fix the template error on Solar air conditioning? Lightmouse (talk) 21:25, 4 July 2011 (UTC)

Done. JIMp talk·cont 23:11, 4 July 2011 (UTC)

Height template

I see that the height template is used within other templates. I picked the first template (Template:Infobox wrestler) and looked at some articles. I noticed that users don't appear to be using the built-in height template. Is there a way of working out which templates-within-templates are redundant? Lightmouse (talk) 08:45, 5 July 2011 (UTC)

  • Article infobox template parameters can be wiki-searched, such as wiki-search "abbr=on" finds uses of that Convert parameter, so wiki-search: wrestler height, to see articles with "wrestler" and where "height" is used (such as the infobox parameter). However, it might be easier to just spot-check several wrestler articles, to count if it is a common problem or rare. If common, then one-by-one fix each article, only when updating other data. Also, change the "Infobox_wrester" doc-page to emphasize use of the builtin height.
    Plus, it would be good if infoboxes using Convert height-in-metres would set rounding precision as "|2". The Template:Height is 40% "more efficient" (8 fewer levels) than Convert (even though {Height} is a wrapper of Convert) because {Height} sets the precision rounding=2, and bypasses the complex auto-precision which Convert needs for other measurements. So, Convert, by default, can only nest 10 levels deep, while {Height} can nest 18 levels deep:
  • NESTED 10 LEVELS: {convert|2|ft|3|in|cm} → 2 feet 3 inches (69 cm)
  • NESTED 18 LEVELS: {height|ft=2|in=3} → 2 ft 3 in (Expression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operatorExpression error: Unexpected < operator m)
So, {Height} is a case of "More is less" (opposite of: Less is more), due to using 8 fewer levels of nested templates. While {Height} seems it should be using more templates, by adding the outer wrapper around Convert 2 levels deeper, instead {Height} actually uses far fewer templates by skipping the {precision...} templates used by Convert. When using {Height}, all those infoboxes are much, much more efficient, because people do not realize when to specify precision in Convert to double the efficiency. Again, this is a shocking case when "More is less" inside infoboxes. We just have to prioritize which things to optimize first, and only fix articles where other changes are also made. Avoid "one-word changes" to articles. -Wikid77 (talk) 15:31, 5 July 2011 (UTC)

Future r=2 to round 2 decimals

When planning the future features for Convert, a big confusing problem has been the rounding with "|0" or "|2" tacked to the end. Instead, we need to migrate to using r=0 (or r=2) and gradually, start using that form in more cases. This is an optional style of new feature: using r=2 will make some conversions, such as with disp=x, to become much easier to control. However, there is no need to "get rid of |0" (instead those can remain), because the r=2 is needed for complex conversions, while "|2" can still be used in millions of simple conversions. The difference is that Template:Convert will need to be changed to look for "r=2" and I think to pass it as the last numbered parameter, with also "{{{rnd}}}" (or similar name) to be passed into hundreds of unit subtemplates, someday. Primarily, the first step is to change only Template:Convert (top level) to look for "r=2" and pass rnd=2, or append 2 as the final numbered parameter: 3, 4, 5, 6, 7 if possible. This is just an initial suggestion to ponder the impacts. -Wikid77 (talk) 15:50, 5 July 2011 (UTC)

I'd been thinking |prec= for "precision" as being more clear (sig fig rounding is still rounding). JIMp talk·cont 16:51, 5 July 2011 (UTC)
That sounds good, so, perhaps have "p=2" to mean precision as 2 decimal digits, where internally, p=2 becomes {{{prec}}} set as 2, but the user puts just "p=2" as a common short option. -Wikid77 17:48, 5 July 2011 (UTC)
I was thinking the other way around, user writes |prec=2 and internally it's {{{p}}} like with |sigfig= and {{{s}}}. Of course, it's no big deal really. JIMp talk·cont 18:01, 5 July 2011 (UTC)

Use sing=ri1 to round input

...and "now for something completely different":  For months (years), people have asked for an option to round the input amount (not just the output values), and now they can, for cases where the input is a very long, many-digit number, but those digits will affect the calculated output. Hide the extra digits, but use them. This cosmetic rounding of the input is possible now, to show 1-3 decimals, using the limited options:  sing=ri1, sing=ri2, or sing=ri3. Remember, this is a very rare situation, as in the following example where someone wants to show 2*pi million kilometres, but not show pi to umpteen digits, just show the many digits in the result. So, 2*pi will be shown as just "6.28" (rounding 2*3.1415...), as follows:

  • 2p million km = ~6.28 million kilometres (3,904,190.3 mi)

The option used is "sing=ri2" for round-input 2 to show the input as 2 decimals (6.28), but calculate 2*pi as 16 digits inside of Convert, plus then show 8 digits for the miles. The markup to invoke Convert now can use:

  • ~{{convert|{{#expr: 2 * 3.141592653589793238 }}|e6km|mi|sing=ri2|1}} → ~6.28 million kilometres (3,904,190.3 mi)

The internal value of 2*pi, as 6.2831853071796, is hidden by option "sing=ri2" but for the calculated millions of miles, the user can show the 8-digit result by rounding the output by "|1" for 1 decimal place in the millions of miles. As noted above, this situation is very rare, but I respect how other people have requested the option, and now, here it is, although highly unusual as rounding just to 1-3 decimals, as sing=ri1, sing=ri2 or sing=ri3. In the example above, a tilde ("~") is shown to indicate "approximate" millions of km, but Convert will simply round the input value, and let the user decide how to explain the short value to the reader. If an article had numerous long scientific measurements to be converted, then the rounded display would be even more useful at that point, to keep articles from being cluttered with many extra digits, while retaining the internal precision to calculate the exact results. Such cases are very rare, but I understand why some people had requested the option, months ago. Now we have it, in limited form. -Wikid77 17:48, 5 July 2011 (UTC)

Nice, very interesting, of course a we'd like to offer a better solution but it'll take some time. JIMp talk·cont 18:07, 5 July 2011 (UTC)
Yes, this is just a start, to get more people thinking about rounding of input amounts. Perhaps most are square roots in calculated measurements, such as the km-to-ft length of the diagonal in a 6.0-×-10.0-kilometre (19,700 × 32,800 ft) rectangle, as the Pythagorean hypotenuse, c2=a2+b2. The diagonal would be  , using the full and then rounded length of the diagonal:
  • {convert|{#expr: (6^2 + 10^2)^0.5 }}|km|ft}} → 11.661903789691 kilometres (38,260.83920502 ft).
  • {convert|{#expr: (6^2 + 10^2)^0.5 }}|km|ft|sing=ri2|0}} → 11.66 kilometres (38,261 ft).
Whereas many engineers might know when to round a length for conversion to feet, a typical user can just show 2-decimal precision (sing=ri2) and not worry about rounding the diagonal for km length, but just use the whole amount, internally, in the conversion. Meanwhile, we need to wait to see what other users want for the rounding levels, other than 1-3 decimal places (perhaps 4-5?). -Wikid77 20:13, 5 July 2011 (UTC)
Well, it depends on the order of magnitude. Perhaps we should be thinking of sig figs. JIMp talk·cont 23:23, 5 July 2011 (UTC)
  • Wrap as Convert/hide: Because the rounding of the input amount would be so rare, I am thinking to create another wrapper as Template:Convert/hide with options to round, or shorten a value such as 2,100,555,333 shown as "2.1E9" for the input (but use all 10 digits in the conversion). Using Convert/hide, then editors could use rounded input with any of "72 options" but there would be only the 1 extra subtemplate as Convert/hide. The creation of Template:Convert/E is a similar wrapper to show x10 notation for E-notation input, where "4.76E15" shows as "4.76×1015". Those wrappers allow for many special options to be added, then explained on the doc page of each wrapper, such as with Convert/gaps and Convert/spell. With 2 million conversions, then most of the millions should remain quick, but allow specialized formats to be handled by the large wrapper templates. We want to avoid the gargantuan centralized {{Citation/core}} which processes 520? parameters inside for each reference (90% of the total markup of large articles), and instead we can use wrappers to reformat special-case items for conversions, outside of the small core templates. In general, when people start suggesting unusual features, then think "wrapper" to handle the glitter, baroque and arabesque features, most of which rarely affect the other features. -Wikid77 17:02, 6 July 2011 (UTC)
A thought ... not fully fleshed out ... s'been floating about my head ... some kind of "version" parameter as a way of escaping into such fancy extensions ... JIMp talk·cont 23:09, 6 July 2011 (UTC)

Strange format

I don't understand this one:

  • {convert|1|cid} -> 1 cubic inch (16 cc) -> 1 cubic inch#Engine displacement (16 cc)

Lightmouse (talk) 16:42, 6 July 2011 (UTC)

That was odd ... it had been like that for years with hundreds of transclusions and never noticed till now. JIMp talk·cont 23:13, 6 July 2011 (UTC)

Convert/2 with any text

I have created a wrapper as Template:Convert/2, similar to Convert/3 and Convert/4, which allows any text to be placed between the converted amounts. Currently, the 2-unit ranges had been restricted to special range-words (to, -, or, by, and, x, etc.). Instead, Convert/2 now will allow any text between the amounts:

  • {{convert/2 |12|rarely|13|m|ft}}      → {{convert/2|12|rarely|13|m|ft}}
  • {{convert/2 |1/4|never|1/8|in|cm}}   → {{convert/2|1/4|never|1/8|in|cm}}
  • {{convert/2 |28|° reaching|36|C|F|disp=x| in summer (|)}} → {{convert/2|28|° reaching|36|C|F|disp=x| in summer (|)}}

Again, the cases of unusual text would be more rare, so Convert/2 handles them while allowing almost any other options of Convert, as parameters. The only catch is to remember putting "/2" in the markup "{{convert/2 |...}}" for converting the special ranges. -Wikid77 17:02, 6 July 2011 (UTC)

Thanks, that's a big improvement. I was familiar with using 'convert' for 2-unit ranges and was surprised by the errors for 3-unit ranges. Learning 'convert/2' from the start will make it easy to guess 'convert/3'. Lightmouse (talk) 17:34, 6 July 2011 (UTC)

Plural units for values less than one

I noticed on the article http://en.wikipedia.org/wiki/Litz_wire , someone has used Convert for a third of an inch, and the result is rendered "1⁄3 inches (8.5 mm)." It seems wrong to have a plural "inches" for a value less than one. No one would say "one third inches long". — Preceding unsigned comment added by 121.73.171.220 (talk) 07:08, 25 June 2011 (UTC)

However they would, at least in British English, with decimals, e.g. "0.33 inches long" ("(naught) point three three inches long"). Again I don't know how Leftpondians would say it but, the most natural formation for fractions here in Blighty would be "of a"/"of an", e.g. "1/3 of an inch", "1/4 of a mile". So the template needs to distinguish decimals and vulgar fractions to properly solve this. Thryduulf (talk) 13:08, 27 June 2011 (UTC)

Yes, "0.25 inches" and "14 of an inch" would be the norm in my dialect too. The Rightpondians (the other pond) might say things differently. Distinguishing between decimals & fractions is the easy part. If we want the "of a(n)", we have to worry about words starting with vowels vs those starting with consonants. Imperial units of capacity will be easy. I think the following is a complete list of all the other unit names starting with a vowel.

  • attojoule
  • attowatt
  • acre
  • acre foot
  • admiralty nautical mile
  • ångström
  • arpent
  • atmosphere
  • electron volt
  • erg
  • inch
  • inch of mercury
  • inch-pound force
  • inch-ounce force
  • hour
  • ounce
  • ounce force
  • ounce per cubic inch
  • ounce per mile
  • ounce of CO
    2
    per mile

Of course most of them are not likely to be used with fractions. Next question, what about 12. We usually drop the "of" (e.g. "half an hour" not "half of an hour") ... right? JIMp talk·cont 16:20, 27 June 2011 (UTC)

Right. In speech, we'll usually drop the 1 in 12 as well ("half an inch" "half and hour", instead of "one half an inch" or "one half an hour"), but since we're writing here, and writing in a somewhat formal manner (or at least, not informally), it my be best to avoid the shorthand practices that people use in speech.
— V = IR (Talk • Contribs) 17:45, 27 June 2011 (UTC)

On the other hand, we are in the practice of omitting things we'd add in speech when writing dates on WP ("27 June 2011" not "the 27th of June 2011"). JIMp talk·cont 21:05, 27 June 2011 (UTC)

I agree. In words you would say "half a mile" (not "one half of a mile") but in symbols it is just "½ mile". -- Dr Greg  talk  22:25, 27 June 2011 (UTC)
  • Use disp=br for singular fractions: In many Convert subtemplates, I already have been showing the singular unit name when < 1.0001 (because people have been asking to round parameter 1, someday, such as rounded "1.00" looking like 1). Hence, when disp=br (square brackets), it shows singular name with fractions: {{convert|1/3|mi|km|disp=br}} = 13 mile
    0.54 kilometres. There could be a check to treat fractions as singular, and decimals as plural, but the fear of the current severe MediaWiki template limit of 40 nested levels, of if-else logic, had made us avoid checking for singular fractions. Now, I think the most-common cases can check to show fractions as singular, without fear of exceeding the template limits. With Convert/spell, all words are used, so it shows:
  • {{convert/spell|3/8|in|cm}} → three-eighths inch (0.95 cm)
  • {{convert/spell|1/2|m|ft|words=out}} → one-half metre (one point six feet)
  • {{convert/spell|4/5|lb|kg}} → four-fifths pound (0.36 kg)
Note how the phrase for a half is "one-half" (with a hyphen), so that is the issue of the "formal tone" of writing, which was noted above. Template:Convert/spell is a good place to experiment with these wording issues, because there are few users there to complain of the choices being made. I think U.S. readers would read 0.27 as "zero point two seven" so British English saying "naught point two seven" is an issue. Would every "0" in 0.20604 also be read as "naught"? -Wikid77 05:32, 4 July 2011 (UTC)
Yes, overload is a worry but I don't think that all is lost. JIMp talk·cont 08:56, 4 July 2011 (UTC)
"Would every "0" in 0.20604 also be read as "naught"?" No. I'd most likely speak that as "naught point two oh six oh four" but possibly (but much less likely) as "naught point two zero six zero four". However, 0.0020604 and 10.0020604 would be "naught point naught naught two oh..." and "ten point naught naught six oh...". 309.0020604 would, depending on context be either "three hundred and nine point naught naught two oh..." or "three oh nine point naught naught two oh...". All have the same "oh/"zero" caveat as the first example, but I can't define the situation off the top of my head. Thryduulf (talk) 23:04, 7 July 2011 (UTC)

Conversion of density

For Displacement (ship) a template to convert 1025 kg/m³ (10.25 lb/ga (imp gallon), 8.55 lb/US gallon) and. 1000 kg/m³ (10.00 lb/ga, 8.35 lb/US gallon). Peter Horn User talk 18:52, 11 July 2011 (UTC)

kg/m3, lb/USgal and lb/U.S.gal exist. I'll look into imperial gallons. JIMp talk·cont 02:03, 12 July 2011 (UTC)
I've created lb/impgal and lb/impgal lb/USgal. JIMp talk·cont 04:46, 12 July 2011 (UTC)

A fourth

Whilst on the topic of {{convert/spell}}, something struck me the other day. {{convert/spell|1/4|mi}} gives "One-fourth mile (1,300 ft)" whereas I'd write "a quarter of a mile ..." (and convert to metres ... what's up with that by the way?). I think it's a dialect thing; a "fourth" is just alien to me. JIMp talk·cont

  • I no longer watch enough British TV shows to know when to use "naught" (for zero) or "quarter" (for 14), but I am ready to reset the words for sp=en or sp=us. The U.S. has the $0.25 coin called the "quarter" and U.S. football games (biggest sport after NASCAR) are in 4 quarters, so many people say "three-fourths" when reading 34, whereas "3 quarters" is commonly $0.75. Many U.S. colleges have 2 semesters (rarely 3 quarters). The miles defaulting to feet is an oversight, which I will fix. -Wikid77 01:01, 12 July 2011 (UTC)

Category - Conversion templates

I've just been told by User:Ezhiki that the {km2 to mi2} template is just a wrapper for this one. He suggested turning the rest at 'Category:Conversion templates' into wrappers too (I think he may be the author of some of those templates). What do people think?

Secondly, I wanted to update the templates within 'Template:Infobox Swiss town' to this one. But I don't have the permission. Can somebody else do it? Lightmouse (talk) 17:06, 5 June 2011 (UTC)

It would be better to have a bot replace calls to all those separate templates by a call to this one and then eliminate them. −Woodstone (talk) 17:26, 5 June 2011 (UTC)
I agree with Woodstone. There is no need for those x to y templates (in general). Sure, in the mean time make them into wrappers. As wrappers they'd come under WP:T3 but considering that they don't actually do anything more than a wrapper would (generally they'd do less), why shouldn't T3 apply anyway? They've been superceeded and many of them have already been deleted on these grounds anyway. Let's have the category filled with templates which actually do various different tasks rather than a whole bunch of redundancies. The only actually useful (besides this) ones are listed in the "See also" section of this doc page (I believe we've got them all & omitted any redundancies). JIMp talk·cont 23:36, 5 June 2011 (UTC)
If I recall, some of them still exist due to the transclusion depth issues of this template. So, I agree with just replacing them and watching out for issues. The problem with wrappers is that they just increase the transclusion depth. Plastikspork ―Œ(talk) 00:13, 6 June 2011 (UTC)
Some wrappers, such as {Height}, reduce transclusion depth by 5-10 levels. The amazing efficiency provided by some wrappers is due to setting the default precision and skipping all 5 or 10 levels of subtemplates used to get auto-precision of numbers. -Wikid77 11:43, 12 July 2011 (UTC)

I came across these templates while doing conversions and delinking common units. I've replaced quite a few and I'm happy to continue doing so. I've only found one or two that with transclusion depth issues and these were solved by specifying precision. I think the 'height' template and 'Infobox settlement' may be ones to watch. I'd prefer to focus more on updating use within articles, can you guys track down and update the templates? Where templates are protected, I can't edit them anyway. Lightmouse (talk) 13:11, 6 June 2011 (UTC)

Keep up the good work. You'll find them at Category:Conversion templates. JIMp talk·cont 15:16, 6 June 2011 (UTC)
Watch out for uses within infobox power station. Frietjes (talk) 16:19, 6 June 2011 (UTC)

This only ever seems to occur within infoboxes at always at {{rnd/b}}. If this is the depth problem, I'm not too sure it is a depth problem (why always at the same point?). JIMp talk·cont 16:38, 6 June 2011 (UTC)

Level 1
73.5 m (241 ft)
Level 2
73.5 m (241 ft)
Level 3
73.5 m (241.1 ft)
Level 1
73.5 °C (164.3 °F)
Level 2
73.5 °C (164.3 °F)
Level 3
73.5 °C (164.3 °F)
(The Level 3 infobox "exceeded depth limit"" unless rounded as "|1" digit. Wikid77 (talk) 18:44, 22 November 2012 (UTC))
Well, a better term is probably "expression depth". I thought that was the conclusion of the discussion at template talk:rnd. Frietjes (talk) 17:34, 6 June 2011 (UTC)
That seems to be the conclusion somewhere along the line. My point is that it's quite interesting that it always breaks at the same point. I've suggested an edit to {{rnd}} which may have no effect at all or might, somehow, miraculously, who knows, fix the problem. JIMp talk·cont 23:10, 6 June 2011 (UTC)
I just found Wikid77's essay on Wikipedia:Avoiding MediaWiki expansion depth limit. It looks like he did a fairly complete analysis of where things are breaking. My guess is that rnd is just at the end of the expansion tree, so it is being pruned. Frietjes (talk) 15:51, 7 June 2011 (UTC)
It is quite informative. I'm guessing that rnd is actually fine but is getting fed something that is beyond the tree. JIMp talk·cont 16:22, 7 June 2011 (UTC)

There are now very few instances left. Can somebody investigate possible uses within other templates the 'height' template and 'Infobox settlement' ? Lightmouse (talk) 21:01, 11 June 2011 (UTC)

If I recall, {{Infobox settlement}} uses its own unit conversions (see the subtemplates). As far as the {{height}} template goes, I can refactor it to not use "m to ft in" or "ft in to m", but there are some technical details which need to be resolved concerning how this template handles fractions. Basically, see Template:M to ft in/testcases and fill in the equivalent syntax for "convert", and I am happy to change the template used by {{height}}. Thanks! Plastikspork ―Œ(talk) 21:28, 11 June 2011 (UTC)

I've put a bunch of these templates up for deletion at TfD. JIMp talk·cont 04:46, 13 June 2011 (UTC)

Thanks. There are still some in Category:Conversion templates that we haven't touched such as:
  • Template:Bbl to t
  • Template:Hands
and there's also Template:RailGauge
I'm happy to continue replacing deprecated templates when workload allows. Lightmouse (talk) 17:49, 21 June 2011 (UTC)

The height template produces fractional outputs:

  • {height|m=1.71} -> 1.71 m (5 ft 7 1⁄2 in)

Is there a way to replicate that with the convert template? Lightmouse (talk) 18:45, 4 July 2011 (UTC)

Proposal to have only one default output

Some users have complained about default multi-output units. I suggest eliminating imperial units from default settings. I went further and considered the possibilities for all the multi-units I could find. Just my thoughts:

Multiple output Suggested single output Comment
1 °R (0.556 K; −458.670 °F; −272.594 °C) 1 °R (0.556 K)
1 astronomical unit (150,000,000 km; 93,000,000 mi) 1 astronomical unit (150,000,000 km)
1 carat (0.20 g) 1 carat (0.20 g) This format already used in WP
1 chain (66 ft; 20 m) 1 chain (20 m)
1 dunam (0.0010 km2; 0.00039 sq mi) 1 dunam (0.0010 km2) This format already used in WP
1 fathom (6.0 ft; 1.8 m) 1 fathom (1.8 m) This format already used in WP
1 furlong (660 ft; 200 m) 1 furlong (200 m) This format already used in WP
1 imperial barrel (160 L; 36 imp gal; 43 US gal) 1 imperial barrel (160 L)
1 imperial bushel (36 L; 8.0 imp gal; 8.3 US dry gal) 1 imperial bushel (36 L)
1 imperial gallon per mile (2.8 L/km; 1.2 US gal/mi) 1 imperial gallon per mile (2.8 l/km)
1 imperial gallon (4.5 L; 1.2 US gal) 1 imperial gallon (4.5 L)
1 imperial fluid ounce (28 ml; 0.96 US fl oz) 1 imperial fluid ounce (28 ml) This format already used in WP
1 imperial pint (0.57 L) 1 imperial pint (0.57 L) litres or ml?
1 imperial quart (1,100 ml; 38 US fl oz) 1 imperial quart (1.1 L) litres or ml?
1 K (−272.15 °C; −457.87 °F) 1 K (−272.15 °C)
1 kilogram-force (9.8 N; 2.2 lbf) 1 kilogram-force (9.8 N) This format already used in WP
1 kilogram force-metre (9.8 N⋅m; 7.2 lbf⋅ft) 1 kilogram force-metre (9.8 N⋅m)
1 kilogram metre (9.8 N⋅m; 7.2 lb⋅ft) 1 kilogram metre (9.8 N⋅m)
1 kilometre per litre (2.8 mpg‑imp; 2.4 mpg‑US) 1 kilometre per litre (2.4 mpg‑US)
1 knot (1.9 km/h; 1.2 mph) 1 knot (1.9 km/h) This format already used in WP
1 litre per 100 kilometres (280 mpg‑imp; 240 mpg‑US) 1 litre per 100 kilometres (240 mpg‑US)
1 litre per kilometre (2.8 mpg‑imp; 2.4 mpg‑US) 1 litre per kilometre (2.4 mpg‑US)
1 millilitre (0.035 imp fl oz; 0.034 US fl oz) 1 millilitre (0.034 US fl oz)
1 litre (0.22 imp gal; 0.26 US gal) 1 litre (0.26 US gal)
1 mile per imperial gallon (280 L/100 km; 0.83 mpg‑US) 1 mile per imperial gallon (280 L/100 km)
1 mile per US gallon (240 L/100 km; 1.2 mpg‑imp) 1 mile per US gallon (240 L/100 km)
1 nautical mile (1.9 km; 1.2 mi) 1 nautical mile (1.9 km) Already used in WP
1 troy ounce (1.1 oz; 31 g) 1 troy ounce (31 g) This format already used in WP
1 rod (17 ft; 5.0 m) 1 rod (5.0 m)
1 square nautical mile (3.4 km2; 1.3 sq mi) 1 square nautical mile (3.4 km2)
1 stone (14 lb; 6.4 kg) 1 stone (6.4 kg)
1 tonne (0.98 long tons; 1.1 short tons) 1 tonne (1.1 short tons)
1 tonne-force (9.8 kN; 0.98 LTf; 1.1 STf) 1 tonne-force (9.8 kN)
1 US barrel (120 L; 32 US gal; 26 imp gal) 1 US barrel (120 L) This format already used in WP
1 US beer barrel (120 L; 31 US gal; 26 imp gal) 1 US beer barrel (120 L)
1 US bushel (35 L; 8.0 US dry gal; 7.8 imp gal) 1 US bushel (35 L)
1 US dry barrel (0.12 m3) 1 US dry barrel (120 L)
1 US dry gallon (4.4 L) 1 US dry gallon (4.4 L)
1 US dry pint (550 ml) 1 US dry pint (0.55 L) litres or ml?
1 US dry quart (1,100 ml) 1 US dry quart (1.1 L) litres or ml?
1 US gallon per mile (2.4 L/km; 0.83 imp gal/mi) 1 US gallon per mile (2.4 l/km)
1 US gallon (3.8 L; 0.83 imp gal) 1 US gallon (3.8 L) This format already used in WP
1 US fluid ounce (30 ml) 1 US fluid ounce (30 ml) This format already used in WP
1 US pint (0.47 L; 0.83 imp pt) 1 US pint (0.47 L) litres or ml?
1 US quart (950 ml) 1 US quart (0.95 L) litres or ml?

Lightmouse (talk) 20:03, 7 July 2011 (UTC)

What's the basis of their complaint? - Denimadept (talk) 20:37, 7 July 2011 (UTC)

Of course this is biased against users of the imperial system (as opposed to the US system) but perhaps we can justify this on the basis that those places where the imperial system was/is used are (supposed to be) metricated: long tons and imperial gallons are on their way out (except for measuring beer and ships). To be honest I'm not particularly fussed either way. I recently created {{convert/Cal/12USozserve}} with a default to convert to kilojoules per litre; it didn't cross my mind to include calories per litre, kilojoules per imperial pint, calories per imperial pint nor any other imaginable possibility (BTU per cubic foot, foot-pounds per US dry quart, tons of TNT per firkin, horsepower hours per cubic nautical mile, blah, blah). P.S. I've taken the liberty of fixing the errors above: use dots (kgf.m or kg.m) not hyphens (kgf-m nor kg-m). JIMp talk·cont 23:51, 7 July 2011 (UTC)

  1. Errors. I copied the code format from the documentation. If the code doesn't work, it'll need to be fixed in the documentation too.
  2. Imperial system. I agree that in all places where the imperial system is used, the metric system is commonplace.
  3. Litres or ml. Did you notice the inconsistent use of litres and ml in the default output?
  4. Transition process. Let's pick one and see how we get on. It seems to me that a bot run is required prior to each change. The bot will make the template specify output units. Then the template default can be changed without any affecting current articles. Does that seem right? Lightmouse (talk) 08:28, 8 July 2011 (UTC)
  • Many 2-unit outputs are needed: As noted with the hand (unit), being wanted to default with both inches and cm, many units still need to default to 2 outputs. In particular, stone as both lb&kg is used in some sports articles, where omitting the weight of an athlete in pounds is very likely to cause extensive debates. For the fathom, many people already know "6 feet" (from "Mark Twain" = 2 deep), so that could be omitted; however, the multiplied result is another issue, beyond just the base conversion: most people will need to see 14 fathoms as "84 feet" rather than 14*6 mental math. People know to drink beer, but not how 1 US beer barrel is 31 US gal. The same logic applies to furlongs, chains, and 27 AU when most people cannot 27*93 million miles, as mental math. Bottom line: Beware complaints as not being a representative sample of a user opinion poll; instead conduct a randomized survey, as in "Your username has been contacted as 1 of 200 users being surveyed about Convert features...": Tell us if you think Convert is too hard to use. Quality control-by-complaint is notorious for only oiling the "squeaky wheel" rather than oiling all wheels when needed. Count the uses of Template:Convert, as being more than 2 million(?), and look at the counts using the subtemplates in the WP:Databases (reports), such as Template:Convert/LoffAonDbSoff to see how often users want only "abbr=on" in their conversions, or counts of Template:Convert/LonAoffDbSoff for only lk=on, or of Template:Convert/LoutAoffDbSoff for only lk=out (etc.). Then, set the defaults as perhaps the most commonly used options. For the default output units, I think many cases of 2-unit output will still be wanted, for years to come. -Wikid77 16:16, revised 17:30, 8 July 2011 (UTC)
I agree with you, the option for default multi-output units is a good one. The question 'should all of them be eliminated?' will inevitably get the answer 'no' and we'll take no action. I say that's the wrong question. Instead, please consider the question 'can any of them be eliminated?'. I happen to agree with the complainer who said converting US fluid ounces to ml and imperial fluid ounces adds little value but adds clutter. Lightmouse (talk) 16:36, 8 July 2011 (UTC)
  • Set rules of thumb for default units: The general cases, of default output unit-codes, can be suggested by rules of thumb, such as:
  1. Output units should default to the viewpoint of typical semi-novice users, whereas scientific experts should specify the output(s).
  2. If many Americans use a unit, it does not need a default US output (such as miles would not default to "feet" or quarts does not need to default to "ounces").
  3. When a unit is relatively rare, then several outputs would be the default.
I think if a scientist wants to focus only on R and kelvins, then specifically put "R|K" in each conversion; otherwise, expect several output units. -Wikid77 17:30, 8 July 2011 (UTC)

It might be good to have guidelines. Does anyone agree with me that there is at least one default that is excessive? Lightmouse (talk) 16:29, 13 July 2011 (UTC)

I think the "t/ST/LT" should be output for each "ton" conversion. I can't speak for the rest of them. - Denimadept (talk) 17:48, 13 July 2011 (UTC)

I don't understand. Can you give an example of each? Lightmouse (talk) 18:08, 13 July 2011 (UTC)

Who are you addressing? If you don't understand the tonne/short ton/long ton thing, well, they're different. - Denimadept (talk) 20:06, 13 July 2011 (UTC)

Embedded conversions in Infoboxes

I found that Template:Infobox_German_location (protected) has not been setting the rounding precision for square miles, which risks the extra 10 nesting depth to get the auto-precision (using Template:Precision/2010). Also, when people put x.xx for "km2" then the equivalent square miles shows as z.zz, which just seems excessive for town area. Many German data sources have excessive precision, which is common for their culture being extremely subdivided, as "pigeonholes within pigeonholes". To avoid the extra digits, I advise to change Template:Infobox_German_location to set precision to 1 decimal place. The markup would become:

{{convert|{{{Fläche|{{{area|0}}}}}}|km2|1|abbr=on}}

The word "Fläche" is German for "area". Compare the results in the following examples:

  • {{convert|23.88|km2|abbr=on}}   → 23.88 km2 (9.22 sq mi)
  • {{convert|23.88|km2|1|abbr=on}} → 23.88 km2 (9.2 sq mi)
  • {{convert|17|km2|abbr=on}}   → 17 km2 (6.6 sq mi)
  • {{convert|17|km2|1|abbr=on}} → 17 km2 (6.6 sq mi)

Other nations use {Infobox settlement} which rounds to "1" digit, such as for Austria's "Template:Infobox Vienna District" which will force 1-digit output rounding, as in: 102.3405 km2 (39.5 sq mi).

I think the precision for square miles as "1" would be a simple fix and would be a lasting change for thousands of German town articles, unlike many other edits in articles. Does that change seem reasonable? -Wikid77 23:43, 14 July 2011 (UTC)

It does. Australia's Template:Infobox Australian place, while it actually does the conversions itself rather than using convert, also limits to 1dp. Orderinchaos 02:38, 15 July 2011 (UTC)

I'm not able to say whether the template reflects German culture. However, integer precision or one decimal place seems to me to be enough for town size area. So yes. Lightmouse (talk) 14:35, 15 July 2011 (UTC)

Error linking Newtons

{{Convert|7|tf|kN lbf|lk=on}} produces 7 tonnes-force (69 kN; 15,000 lbf); however, the link should be to Newton (unit), not to Newton the disambiguation page. --R'n'B (call me Russ) 16:19, 15 July 2011 (UTC)

Fixed. Thanks! Plastikspork ―Œ(talk) 19:46, 16 July 2011 (UTC)

missing template Convert/LoffAoffDoutSoffT

Please can someone who understands the convert templates add the missing Template:Convert/LoffAoffDoutSoffT -

  • {{convert|78|°F|disp=out}}: 26 °C

Cheers, Thryduulf (talk) 11:52, 19 July 2011 (UTC)

problems with abbr=none and abbr=in for temperature

Some of the possible combinations of conversions between Celcius, Fahrenheit and Kelvin when explicitly specifying what abbreviations are wanted do not label the units. I think the following list of 36 combinations shows them all, those 14 that don't work are extracted to the sortable table below the list.

  1. {{convert|78|°F|abbr=none}} — 78 degrees Fahrenheit (26 degrees Celsius)
  2. {{convert|78|°C|abbr=none}} — 78 degrees Celsius (172 degrees Fahrenheit)
  3. {{convert|78|°F|°C|abbr=none}} — 78 degrees Fahrenheit (26 degrees Celsius)
  4. {{convert|78|°C|°F|abbr=none}} — 78 degrees Celsius (172 degrees Fahrenheit)
  5. {{convert|78|°F|abbr=in}} — 78 °F (26 degrees Celsius)
  6. {{convert|78|°C|abbr=in}} — 78 °C (172 degrees Fahrenheit)
  7. {{convert|78|°F|°C|abbr=in}} — 78 °F (26 degrees Celsius)
  8. {{convert|78|°C|°F|abbr=in}} — 78 °C (172 degrees Fahrenheit)
  9. {{convert|78|°F|abbr=out}} — 78 degrees Fahrenheit (26 °C)
  10. {{convert|78|°C|abbr=out}} — 78 degrees Celsius (172 °F)
  11. {{convert|78|°F|°C|abbr=out}} — 78 degrees Fahrenheit (26 °C)
  12. {{convert|78|°C|°F|abbr=out}} — 78 degrees Celsius (172 °F)
  13. {{convert|78|K|abbr=none}} — 78 kelvins (−195.2 degrees Celsius; −319.3 degrees Fahrenheit)
  14. {{convert|78|K|°C|abbr=none}} — 78 kelvins (−195.2 degrees Celsius)
  15. {{convert|78|K|°F|abbr=none}} — 78 kelvins (−319.3 degrees Fahrenheit)
  16. {{convert|78|K|°C °F|abbr=none}} — 78 kelvins (−195.2 degrees Celsius; −319.3 degrees Fahrenheit)
  17. {{convert|78|°F|K|abbr=none}} — 78 degrees Fahrenheit (299 kelvins)
  18. {{convert|78|°C|K|abbr=none}} — 78 degrees Celsius (351 kelvins)
  19. {{convert|78|°F|°C K|abbr=none}} — 78 degrees Fahrenheit (26 degrees Celsius; 299 kelvins)
  20. {{convert|78|°C|°F K|abbr=none}} — 78 degrees Celsius (172 degrees Fahrenheit; 351 kelvins)
  21. {{convert|78|K|abbr=in}} — 78 K (−195.2 degrees Celsius; −319.3 degrees Fahrenheit)
  22. {{convert|78|K|°C|abbr=in}} — 78 K (−195.2 degrees Celsius)
  23. {{convert|78|K|°F|abbr=in}} — 78 K (−319.3 degrees Fahrenheit)
  24. {{convert|78|K|°C °F|abbr=in}} — 78 K (−195.2 degrees Celsius; −319.3 degrees Fahrenheit)
  25. {{convert|78|°F|K|abbr=in}} — 78 °F (299 kelvins)
  26. {{convert|78|°C|K|abbr=in}} — 78 °C (351 kelvins)
  27. {{convert|78|°C|°F K|abbr=in}} — 78 °C (172 degrees Fahrenheit; 351 kelvins)
  28. {{convert|78|°F|°C K|abbr=in}} — 78 °F (26 degrees Celsius; 299 kelvins)
  29. {{convert|78|K|abbr=out}} — 78 kelvins (−195.2 °C; −319.3 °F)
  30. {{convert|78|K|°C|abbr=out}} — 78 kelvins (−195.2 °C)
  31. {{convert|78|K|°F|abbr=out}} — 78 kelvins (−319.3 °F)
  32. {{convert|78|K|°C °F|abbr=out}} — 78 kelvins (−195.2 °C; −319.3 °F)
  33. {{convert|78|°F|K|abbr=out}} — 78 degrees Fahrenheit (299 K)
  34. {{convert|78|°C|K|abbr=out}} — 78 degrees Celsius (351 K)
  35. {{convert|78|°C|°F K|abbr=out}} — 78 degrees Celsius (172 °F; 351 K)
  36. {{convert|78|°F|°C K|abbr=out}} — 78 degrees Fahrenheit (26 °C; 299 K)


The incorrectly functioning conversions
No. Input Output Abbreviation
1. °F (unspecified) none
2. °C (unspecified) none
5. °F (unspecified) in
6. °C (unspecified) in
13. K (unspecified) none
16. K °C °F none
17. °F K none
18. °C K none
19. °F °C K none
20. °C °F K none
21. K (unspecified) in
24. K °C °F in
27. °C °F K in
28. °F °C K in

Feel free to copy/adjust the list and table as required for fixing the issue(s). The same list and table are also at user:Thryduulf/Conversion sandbox#Temperature, where you can also experiment. Thryduulf (talk) 12:37, 19 July 2011 (UTC)

  • Thanks for reporting those missing unit names. Originally, the temperature conversions only showed symbols (°F/°C/K), so the full unit names were added later, but not for all possible cases. The tactic has been to add more when actually used in articles, because there are over "74,000" possible conversion option settings, and most of them are never used. Hence, people have not taken the time to add all the possible thousands of cases. In particular, the following would seem to be valuable cases to have working:
  • {{convert|78|°F|°C|abbr=none}} → 78 degrees Fahrenheit (26 degrees Celsius)
  • {{convert|78|°F|abbr=none}}   → 78 degrees Fahrenheit (26 degrees Celsius)
  • {{convert|78|°F|K|abbr=none}} → 78 degrees Fahrenheit (299 kelvins)
That 2nd conversion would require changing Template:Convert/LoffAnoneDbSoffT to handle {{{3}}} as being a "K" to show "kelvins" rather than "degrees". We create variations of the current subtemplates, to debug the markup logic to handle more cases, so a variation using abbr=none2 has been created. Fixes inside Template:Convert/LoffAnone2DbSoffT will give:
  • {{convert|78|°F|°C|abbr=none2}} → 78 °F (26 °C)*
  • {{convert|78|°F|abbr=none2}}   → 78 °F (26 °C)*
  • {{convert|78|°F|K|abbr=none2}} → 78 °F (299 K)*
After more testing, then Template:Convert/LoffAnone2DbSoffT can be used to show how to update the original Convert/LoffAnoneDbSoffT to fix the output unit names. Thanks again for spotting those problems. -Wikid77 08:57, 20 July 2011 (UTC)

Slashes

I would like to see the end of slashes. These aren't a very good way of separating two values. A slash is normally used for division "1 lb/454 g" looks like one pound divided by 454 g. Most of these would be better with "or" instead. JIMp talk·cont 02:10, 7 July 2011 (UTC)

  • For most cases, we could remove them; however, some people are using tables with "abbr=values" to show only the 2 values separated by slashes, as in temperatures C/F, such as: 0/32, 100/212. Other common problems, with slashes, have been the disagreements about spaces " / " around them, and wrapping the text either before/after the slash. I am not sure of what ways to limit the use of slashes, but perhaps the option should not be "promoted" as a common style. If people don't see it much (in the doc page or examples), then they will not use the feature. That could be step 1, as subtopic below: "#Motion to not show slashes in doc page". -Wikid77 13:51, 7 July 2011 (UTC)
Without units (like in the examples, "0/32" and "100/212", above) it looks even more like a division. Why not use disp=table? I think the best solution would be to have a bot convert them to "or"s. JIMp talk·cont 14:36, 12 July 2011 (UTC)

Motion to not show slashes in doc page

7-July-2011: This is a WP:Consensus discussion, about not promoting use of slashes, by omitting the slash options from the Convert documentation page, Template:Convert/doc.

Agree
(All who agree, list your comments here; see below Oppose/Neutral.)
  1. Agree. I think slashes should not be mentioned, as "disp=/" or "disp=s" in the Convert/doc page, to deter their usage, which looks like division to some users. -Wikid77 13:51, 7 July 2011 (UTC)
  2. Agree. I'd actually removed them from the doc already. Of course, if there's consensus to keep them I can live with that. JIMp talk·cont 14:04, 7 July 2011 (UTC)
Oppose
(All who oppose not mentioning slashes, list your comments below.)
  1. Oppose. The slashes are needed when the conversion appears between brackets ie (10 m (33 ft)*), the following does not look nice (10 m (33 ft)) Peter Horn User talk 19:10, 11 July 2011 (UTC)
Neutral
(All users neutral about slashes, list your comments below.)
  1. Neutral. State why.

End of consensus discussion about slashes in doc page. -Wikid77 (talk) 13:51, 7 July 2011 (UTC)

For the record, I also oppose the use of slashes as a separator. As has been stated, they are already used for division so things like 'cuft/s/m3/s', 'ft/min/m/s' 'km/h/mph' look weird. Lightmouse (talk) 16:29, 21 July 2011 (UTC)

Convert chooses output unit based on number size

Reminder: Currently, Convert will automatically choose from a variety of output units, based on number size, where the editor might be unfamiliar with the alternate units. The concept of the output varying by number size is an issue of "number sense" (taught widely now in U.S. schools, along with consumer math, computerized typesetting, and other new-fangled ideas of the past 30 years). Currently, the default conversion of "m" varies by size:

  • {{convert|1|m}}   → 1 metre (3 ft 3 in)
  • {{convert|1.5|m}} → 1.5 metres (4 ft 11 in)
  • {{convert|1+1/2|m}} → 1+12 metres (4 ft 11 in)
  • {{convert|2|m}}   → 2 metres (6 ft 7 in)
  • {{convert|4|m}}   → 4 metres (13 ft)
  • {{convert|400|m}}   → 400 metres (1,300 ft)

Each editor is free to override the "smart auto-defaults" by putting the output unit-code in parameter 3. Also, I have advocated the use of even more smart-conversion tactics, to help new users with conversions, without adding any significant overhead to page formatting. -Wikid77 13:51, 22 July 2011 (UTC)

In all these cases the input unit "m" is converted to the same output unit "ft". Only because of the peculiarity of the imperial system, decimal places are converted to duodecimal places, introducing a secondary unit "in". The given examples show that the template does not do a good job. For whole meters, a conversion including inches is overly precise. For 1.5 m the inches are correctly added to reflect a supposed precision of 0.05 m. −Woodstone (talk) 16:41, 22 July 2011 (UTC)
The implicit precision, as "1 m" being 1.0 m, is a part of the "number sense" concept. In contrast, "100 m" is likely to be rounded more, from roughly 95-104 m rounded as 100 m to the nearest 10 m. In this manner, "500 miles" is rounded to the nearest 100 miles, or "10,000 miles" is rounded to the nearest 1,000 miles. These issues of number sense are seen in cooking recipes, where "1 pound" of flour is considered 1.0 pound, and using 1.4 pounds rounded down to being "1 pound" of flour would make the food too dry. Hence, extra precision is assumed for "1 m":
  • {{convert|1|m}}   → 1 metre (3 ft 3 in)
  • {{convert|1.0|m}} → 1.0 metre (3 ft 3 in)
We have had numerous debates about such precision issues, where some people wanted to treat "100 m" as rounded to the nearest 50 m. So, other people have mentioned your viewpoint previously. -Wikid77 23:12, 22 July 2011 (UTC)

Another 3 way

For Ford Model T engine, 177 cu in (2,900 cc; 2.90 L) and 177 cu in (2,900 cm3; 2.90 L) instead of 177 cu in (2896 cc) (2.9 L). note: 2,896 cc (176.725 cu in) or 2,896 cm3 (176.725 cu in) Peter Horn User talk 00:41, 14 June 2011 (UTC)

Why convert cu in to both cc and litres? Anybody who knows cc will also know litres. Better to just convert cu in to cc with the convert template. Note also that cc measurements in WP:Automobiles are usually expected to be accurate to 1 cc. Roundings are normally expressed in litres.  Stepho  talk  03:49, 14 June 2011 (UTC)
I don't see the need for both. JIMp talk·cont 23:28, 29 June 2011 (UTC)

More insanity

I recently received the following complaint about a three way:
  • "Changing 119 12-ounce beers in 6 hours to 119 12-US-fluid-ounce (350 ml; 12 imp fl oz) beers in 6 hours is not my idea of a sane conversion"
I agree with that. I'd like to see all three ways subject to a review. Even if we eliminated one, that would be a bonus. How many are there? Lightmouse (talk) 00:55, 30 June 2011 (UTC)

True, 12 US fl oz (12 imp fl oz) is silly. Also 12 US fl oz (350 ml) lacks precision. It's a standardised volume not a measured one, they even print "355 mL" on the can/bottle (they do in Canada at least ... on cans, botttles are imperial ... rolls eyes). "12-US-fluid-ounce (355 ml)" would be better but let's not forget the important fact that there are 119 of them. Who cares about the size of each can/bottle? What's important is the total volume: "119 twelve-US-fluid-ounce cans (11.2 US gal; 42.2 L; 9.3 imp gal) of beer in six hours".

This is where the main insanity lies here but, Lightmouse, you want to question three-way conversions. This is a fair point. Do we need to include imperial measures when converting between US and metric? Do we need long tons when converting from short tons to tonnes? Do we need stones when converting between kilograms and pounds? Do we need statute miles and/or mph when converting between nautical miles and/or knots and kilometres and or km/h? Actually the very question is coming up elsewhere too right now. Do we need feet and/or inches when converting horse heights between hands and centimetres? Do we need imperial horsepower when converting from metric horsepower to kilowatts?

It's an interesting problem but ... are you suggesting we eliminate three-ways from the defaults or eliminate them as an option altogether? JIMp talk·cont 02:21, 30 June 2011 (UTC)

I suggest we look at each three-way default and eliminate those that we can. I wasn't suggesting eliminating any option, it hadn't even occured to me. Lightmouse (talk) 02:42, 30 June 2011 (UTC)

No, that's what I thought you were saying but I just wanted it to be made clear to others who might be interested (without putting words in your mouth). The three-way defaults that spring to mind are millilitres/litres/etc. to imperial & US, tonnes to long & short tons and nautical miles/knots to kilometres & statute miles (per hour). Are there more (it's hard to remember)? JIMp talk·cont 04:44, 30 June 2011 (UTC)

  • 1 °R (0.556 K; −458.670 °F; −272.594 °C)
  • 1 astronomical unit (150,000,000 km; 93,000,000 mi)
  • 1 carat (0.20 g)
  • 1 chain (66 ft; 20 m)
  • 1 dunam (0.0010 km2; 0.00039 sq mi)
  • 1 fathom (6.0 ft; 1.8 m)
  • 1 furlong (660 ft; 200 m)
  • 1 horsepower (0.75 kW)
  • 1 imperial barrel (160 L; 36 imp gal; 43 US gal)
  • 1 imperial bushel (36 L; 8.0 imp gal; 8.3 US dry gal)
  • 1 imperial gallon per mile (2.8 L/km; 1.2 US gal/mi)
  • 1 imperial gallon (4.5 L; 1.2 US gal)
  • 1 imperial fluid ounce (28 ml; 0.96 US fl oz)
  • 1 imperial pint (0.57 L)
  • 1 imperial quart (1,100 ml; 38 US fl oz)
  • 1 K (−272.15 °C; −457.87 °F)
  • 1 kilogram-force (9.8 N; 2.2 lbf)
  • {{convert|1|kgf-m}}
  • {{convert|1|kg-m}}
  • 1 kilometre per litre (2.8 mpg‑imp; 2.4 mpg‑US)
  • 1 knot (1.9 km/h; 1.2 mph)
  • 1 litre per 100 kilometres (280 mpg‑imp; 240 mpg‑US)
  • 1 litre per kilometre (2.8 mpg‑imp; 2.4 mpg‑US)
  • 1 millilitre (0.035 imp fl oz; 0.034 US fl oz)
  • 1 litre (0.22 imp gal; 0.26 US gal)
  • 1 mile per imperial gallon (280 L/100 km; 0.83 mpg‑US)
  • 1 mile per US gallon (240 L/100 km; 1.2 mpg‑imp)
  • 1 nautical mile (1.9 km; 1.2 mi)
  • 1 troy ounce (1.1 oz; 31 g)
  • 1 rod (17 ft; 5.0 m)
  • 1 square nautical mile (3.4 km2; 1.3 sq mi)
  • 1 stone (14 lb; 6.4 kg)
  • 1 tonne (0.98 long tons; 1.1 short tons)
  • 1 tonne-force (9.8 kN; 0.98 LTf; 1.1 STf)
  • 1 US barrel (120 L; 32 US gal; 26 imp gal)
  • 1 US beer barrel (120 L; 31 US gal; 26 imp gal)
  • 1 US bushel (35 L; 8.0 US dry gal; 7.8 imp gal)
  • 1 US dry barrel (0.12 m3)
  • 1 US dry gallon (4.4 L)
  • 1 US dry pint (550 ml)
  • 1 US dry quart (1,100 ml)
  • 1 US gallon per mile (2.4 L/km; 0.83 imp gal/mi)
  • 1 US gallon (3.8 L; 0.83 imp gal)
  • 1 US fluid ounce (30 ml)
  • 1 US pint (0.47 L; 0.83 imp pt)
  • 1 US quart (950 ml)

Errors are shown against 'kgf-m' and 'kg-m' even though I copied the text from the documentation. Lightmouse (talk) 17:23, 6 July 2011 (UTC)

Now what

In Inekon Trams, and elsewhere, 26 t (28.7 short tons; 25.6 long tons) 29 metric tons (32.0 short tons; 28.5 long tons). Eliminating that threeway created havoc!!! Peter Horn User talk 20:12, 18 July 2011 (UTC)

The elimination of the three-way conversion wasn't what created the havoc. In fact the three-way still exists & is still the default. The havoc was due to the template's not being ready to spell out the units. JIMp talk·cont 23:21, 18 July 2011 (UTC)
26 metric tons (28.7 short tons; 25.6 long tons) is redundent as 26 metric tons (28.7 short tons; 25.6 long tons) does the same thing. Also in 26 t (28.7 short tons; 25.6 long tons), why is "abbr=on|" igmored? Peter Horn User talk 02:33, 19 July 2011 (UTC)
According to Wikipedia:Mosnum#Specific units there is no abbreviation for long or short tons. JIMp talk·cont 06:01, 19 July 2011 (UTC)
I looked at Inekon Trams. It seems to me to be a good example of why the tonne only needs to be converted to the short ton. Lightmouse (talk) 10:44, 19 July 2011 (UTC)
Would that not depend on who is the reader? Peter Horn User talk 16:20, 19 July 2011 (UTC)

Modern train specifications are in kg and lb. As far as I'm aware, where a ton is used instead, it will be metric or US. If there are any readers that don't know either of those units, I'd like to know why. Lightmouse (talk) 16:55, 19 July 2011 (UTC)

The weight of British and Australian locomotives apears as long tons in the infoboxes of the articles. Peter Horn User talk 16:13, 27 July 2011 (UTC)

Yes, old trains were specified in long tons, but not now. If the input is tonne then the *default* output should be ST only. If the input is ST then the *default* output should be tonne only. Lightmouse (talk) 17:44, 27 July 2011 (UTC)

Trouble with sortable=on

I had a problem using the |sortable=on option. See this sandbox version of a sortable table. The "length" column does not sort the way I expected. Values with a decimal part end up at the bottom of the column. See this version of Long-distance trails in the United States. I used the {{sms}} template and it works. (I tried {{nts}} but it produced strange output.) Output for the High Sierra Trail length looks like this:

|sortable=on generates <span style="display:none">00000000000061.5</span>61.5 mi (99.0 km)
{{sms}} generates <span style="display:none">&0061.5</span>61.5 mi (99.0 km)

The left padding was done manually using {{sms}}. So placing an & before the left most zero might fix the problem. –droll [chat] 05:14, 16 July 2011 (UTC)

P.S. Well, its not that simple because padleft counts the decimal point and what follows in the string length. –droll [chat] 15:03, 16 July 2011 (UTC)

P.P.S. Using {{nts}} instead of {{padleft:}} in {{convert}} seems to work. –droll [chat] 15:30, 16 July 2011 (UTC)

Yes, I believe you have discovered a known issue (see here for example). I think we should try to fix this bug if possible. Calling another template to generate the sort key seems like the best solution, rather than reinventing a new method here. If you want to generate something simple and robust in the sandbox, we can update the template here. Thanks! Plastikspork ―Œ(talk) 19:51, 16 July 2011 (UTC)
I'm working on it. –droll [chat] 02:29, 17 July 2011 (UTC)

I put a new version in the sandbox. A test case is at testcases. It works better than the current version but behaves strangely with negative numbers (as does the current version). It works for 16 digits before, and 6 digits after the decimal separator. See the documentation for {{ntsh}} (which is not up to date). See the documentation for {{nts}} for what happens with negative numbers. I worked all day trying to come up with a version that sorts negative numbers correctly but only got a headache. –droll [chat] 05:06, 17 July 2011 (UTC)

I just found {{ntsc}} but it does not allow options. –droll [chat] 05:26, 17 July 2011 (UTC)

Will someone please take a look at the testcases and make a comment. Being ignored does not feel very good. –droll [chat] 04:04, 23 July 2011 (UTC)

I've been away on travel for the last week or so. Unfortunately, I am off again soon, but will try to have a look before I leave. Plastikspork ―Œ(talk) 21:22, 24 July 2011 (UTC)
Okay, I had a look, and it does appear to be a significant improvement, so I synced the sandbox with the template. Let me know (and/or revert) if there is a problem. Thanks for working on this. Plastikspork ―Œ(talk) 21:28, 24 July 2011 (UTC)

Is it supposed to be sortable if the input uses commas? It didn't work for me when I investigated Wikipedia:Help desk#sorting of US state. Here is a simplified example:

Commas in source No commas in source
3,900 sq mi (10,000 km2) 3,900 sq mi (10,000 km2)
3,500 sq mi (9,000 km2) 3,500 sq mi (9,000 km2)
12,000 sq mi (30,000 km2) 12,000 sq mi (30,000 km2)

The first column currently sorts 10,000 9,000 30,000. The second column correctly sorts 9,000 10,000 30,000. The html of the rendered page for the first column contains the code <span style="display:none">&<strong class="error">Expression error: Unrecognised punctuation character ","</strong></span> in front of the displayed area where the hidden sort key should have been. PrimeHunter (talk) 00:58, 28 July 2011 (UTC)

I added a bit to the markup in the sandbox and moved you example to the testcases page. Take a look at the testcases and see if the sandbox version behaves as you expect. Someone should double check my fix, as I miss stuff sometimes. –droll [chat] 02:54, 28 July 2011 (UTC)
Using disp=flip might cause a problem as the sort is done on the first parameter value and not the results after rounding. Doing the sort using {{convert|...|disp=output number}} as the sort key would work, but then the complexity is 2n. –droll [chat] 03:30, 28 July 2011 (UTC)
Thanks. The sandbox version sorts my example correctly, and also the original larger example at U.S. state#List of states when it's previewed with {{Convert/sandbox}}. I don't know enough to evaluate whether the fix has unintended consequences in other cases. PrimeHunter (talk) 12:27, 28 July 2011 (UTC)
I synced the sandbox. Droll's fix was exactly what I would have suggested. The sortable option is still not exactly perfect (e.g., with {{convert|6|ft|2|in}}), but this will be an improvement. Thanks! Plastikspork ―Œ(talk) 15:18, 29 July 2011 (UTC)

Specifying rounding via unnamed parameter doesn't work with multiple conversions

  • {{convert|20|AU|0}} → 20 astronomical units (2.991957414×109 km; 1.859116145×109 mi)
  • {{convert|20|AU|km mi|0}} → 20 astronomical units (2.991957414×109 km; 1.859116145×109 mi)
  • {{convert|20|AU|km mi|sigfig=1}} → 20 astronomical units (3×109 km; 2×109 mi)

A. di M.plédréachtaí 10:29, 24 July 2011 (UTC)

See also Template talk:Convert/Archive June 2011#Problems with disp=x and fluid ounces, the rounding errors discussed there might be relevant. Thryduulf (talk) 12:43, 24 July 2011 (UTC)
I think I get now. Apparently the unnamed parameter disregards the ×109 in the output, so that |0 means “round to the nearest 10−0 kilometres”, not “to the nearest 10−0 ×109 kilometres”. A. di M.plédréachtaí 16:59, 24 July 2011 (UTC)
  • Use sigfig=2 with huge numbers: Yes, when the rounding parameter is "|0" then it rounds even huge numbers to the nearest 1 output unit, regardless of x109. So, use sigfig=2 (or sigfig=3) when rounding gigantic numbers to just a few digits. Otherwise, the actual rounding parameter would be "|-6" (or "|-9") to round the x10-notation amounts. -Wikid77 02:40, 30 July 2011 (UTC)

Please change tonne default output to suit majority need

The tonne is converted by default to LT and ST. The majority need for the tonne conversion is ST only. We have (or should have) a higher standard for multiple output defaults. In the few cases where the long ton is needed, it can be specified. Please can the default be updated? Lightmouse (talk) 11:36, 31 July 2011 (UTC)