Q: When using {{convert}} why does the answer sometimes seem a bit off?
A: This template takes into account the precision of the supplied value and generally rounds the output to the same level of precision. If you need to change from the default output precision, see rounding.
Note: This can cause whole numbers that end in one or more zeroes to be converted less accurately than expected.
Q: What are all the possible units (kg, lb, m, cm, ft, in, °C, °F, km, mi, nmi, mph, km/h, and so on)?
Q: I've been using Convert for some time and am pretty comfortable with its basic features. Does it have other features which it would be worth my while to learn about?
Template:Convert is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases.
Can we please get suf1 and suff2 parameters added to this template, like done at Template:Change, so that we can add references or notes to the first and second numbers in the template, respectively? Cheers, Hwy43 (talk) 20:10, 26 December 2024 (UTC)[reply]
The purpose of convert is to take a single number and convert it into the equivalent in different units of measurement. All numbers displayed come from that single input. So why would we need a second reference?
Likewise, why would we have different notes for each unit of measurement? Surely a single reference and/or note cover all the units used. Can you give an example? Stepho talk23:42, 26 December 2024 (UTC)[reply]
Good point re: single input. Rather, a suffix parameter is desired just for after the first number because it is the one that can be sourced, whereas the second is a product of the template. Same with notes being based on the first number. See the Flin Flon and Lloydminster rows at List of cities in Saskatchewan#List. In those two cases, I want the notes to be displayed after the first number, not after the second (conversion) number as currently shown. Cheers, Hwy43 (talk) 00:29, 27 December 2024 (UTC)[reply]
Fair enough, this only applies to tables. The |pre= option (with the ref as the next field) can be twisted into doing what you want. {{convert|2.01|km2|sqmi|disp=table|sortable=on|adj=pre|<ref group=SK>col1 note</ref>}} gives:
I suppose so but after all these years without it, I wonder if a new unit would be much benefit. Would cmil be used in any other articles or would it only be used for the approximate values shown in this article? Any thoughts from watchers? Johnuniq (talk) 00:23, 29 December 2024 (UTC)[reply]
Hello, new to this, but any idea why units might not be getting correctly transliterated? Didn't get any response on Bengali wikipedia so decided to ask here.
The issue is on the top of this page: bn:স্থানীয়_গোষ্ঠী. What I want is megaparsec and light-year to be correctly transliterated as মেগাপারসেক and আলোকবর্ষ, just like kilometer is being transliterated as কিলোমিটার. Those articles do exist on the BN wikipedia.
Thanks! Babaisarkar2 (talk) 10:48, 1 January 2025 (UTC)[reply]
There are a multitude of different kinds of cups, depending on which country the measurement is being made in, and even within a country. I'm not sure we want to mess with all that. Jc3s5h (talk) 17:09, 7 February 2025 (UTC)[reply]
The same is true for gallon and ton. We handle those in a way that causes the editor to realize the distinction and explicitly pick which one they need. I have found this very helpful when introducing the required metric conversions to articles based on US sources. -- Beland (talk) 20:38, 7 February 2025 (UTC)[reply]
Would you like to name them all? Just think of the joy of having 19 names for 12 unique sizes to choose from. Would you trust random editors to choose the right cup name? Remember that this is an international encyclopedia and we can't just say to use the US definition (or any other country's). Even within one country do you trust people to know the difference between an official modern cup, a traditional cup, a coffee cup and tea cup? Remember that we still editors confusing imperial/US gallons, metric/long/short tons and hp/PS. Stepho talk00:32, 8 February 2025 (UTC)[reply]
Well, according to MOS:CONVERSIONS we have to do metric conversions in most cases whether the module supports them or not. Without them, most people in the world won't be able to understand the volume being described or won't be able to use it in calculations. We need to either correctly resolve any uncertainty over which cup is being used, or express metric units in a way that indicates that uncertainty.
When there are multiple definitions of the same unit, using the template means that it's clear which definition is being used, and it's easy to verify from article context that this is correct. It also means there's no need to check that the math has been done correctly. If there is no template support, editors still have to pick a definition and do a metric conversion; it seems to me they are just less likely to do so correctly.
I agree with Johnuniq and Martin of Sheffield who said we only need to support conversion for the units that are actually used in articles. I assume Vitamin D is using the US legal definition of 240 mL. This is pretty close to the 237 mL US customary definition and the 250 mL "metric cup" used by several English-speaking countries. One idea would be to simply have the module reduce the number of significant digits in the metric output so a single "cup" or e.g. "cupApprox" value could cover all these, which are most or all use cases. Or just have "cupUS" to cover 237/240 (given it'll be hard to tell the difference between those from context) and "cup250" to cover other countries with a common definition.
It's possible that the coffee cup definitions are also used in articles somewhere, but I'm skeptical all 19 values are actually needed; the analysis by Ich indicates the others are rare or historical only. I will do a database scan and find out for sure. -- Beland (talk) 01:19, 8 February 2025 (UTC)[reply]
A problem is that adding a template to an article somehow looks like an official assurance that the numbers are correct. It may well be that your edit at Vitamin D which interpreted a cup as 240 mL is correct, but in general sources are silent on what kind of cup they are referring to. That is pretty reasonable because the values are very rough. In this case, the issue concerns 1⁄2 a cup of mushrooms which, IMHO, could mean anything from 150 to 300 mL as, unless they are talking about finely chopped mushrooms, there would be a lot of empty space in such a cup, and a lot of wriggle room in how carefully the mushrooms are packed, and how far they exceed the height of the cup. In a situation like this, it may be that 1 cup is the best that can be done. Johnuniq (talk) 04:21, 8 February 2025 (UTC)[reply]
OK, the database scan was very informative. To limit the number of results I had to sift though manually, I searched for "1 cup". There are hundreds of articles that use fractional or multiple cups. After eliminating hundreds of articles about sports and 2 Girls 1 Cup, I found 77 general articles that use "1 cup" as a unit of measure (see the collapsed list below).
One important lesson is that recipes in the US are often measured by volume, whereas the rest of the world generally uses weight, to avoid exactly the sort of accuracy problems that happen when measuring the volume of a pile of irregular objects (like "1 cup of mushrooms"). The template cannot do volume-to-weight conversion because that depends on the material. This accounts for about a third of the 77 articles.
Some articles do explicitly convert to mL, which means an adequate definition of "cup" was available from the source or context. Eyeballing the whole list, I think it would be safe to always assume that unless an explicit mL conversion is given (as happens in our coffee-related content), the cup being referenced is one of the three main choices identified above (237, 240, or 250 mL). Given the imprecision of food prep, treating 1 cup as a quarter-liter is probably fine, and displaying "~250 mL" seems to me a sensible default behavior for "cup". I'm also happy to only have three options like "cup237", "cup240", and "cup250" out of accuracy paranoia, and maybe tell editors in the documentation to specify a low number of significant digits if they are uncertain from context? We definitely do not need the module to support all 19 definitions.
Fractional cups are used, so we'd need to handle a half, quarter, and third of a cup with satisfactory uncertainty, but I couldn't find an instance of an eighth-cup in our content. A quarter cup is 59.1-62.5, so ~60 mL, and a third is ~80 mL. A sampling of articles that use fractions:
Thanks for the ping and the exhaustive research. Honestly, after my foray into the world of cups after my post above, my takeaway was that Convert probably shouldn't bother supporting it, unless some completionists want to stop using hardcoded values on the pages discussing measurement units. I've used the convention 1 cup ({{convert|240|ml|ml|disp=out}}) for tricky unsupported units, e.g. "teaspoons" on laudanum. Things like nutrition values are better executed as a calories/100 grams anyway (and it's possible to find authoritative sources that use grams to begin with, like this FDA table). Wikipedia doesn't have too many recipes in it – they're better in grams anyway – and as you mentioned, the volume/mass conversion should remain out-of-scope for convert templates.-Ich(talk)15:50, 8 February 2025 (UTC)[reply]