Jump to content

Template talk:Convert

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Sbb (talk | contribs) at 20:13, 24 March 2024 (→‎Unitless numbers; %, ‰, ppm, ppb, etc.: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

... in conception
... and in reality

Bogus unit "kiloare"

The code "ka" is supposed to give "kiloannum" or "millennium", but on a few pages like Ojos del Salado it gives "kiloare". Jo-Jo Eumerus (talk) 16:16, 24 January 2024 (UTC)[reply]

NIST Special Publication 811 in the conversion tables does list "a" as a symbol for are. In this article, providing a conversion to a mixed unit, cubic miles per are, seems wrong. I think it would be better to just not give conversions. Jc3s5h (talk) 17:03, 24 January 2024 (UTC)[reply]
Problem is that even as a legitimate unit, "ka" is already specified as "kiloannum" or "millennium" in the code so it should be converted to that and not "kiloare". Jo-Jo Eumerus (talk) 07:54, 25 January 2024 (UTC)[reply]
Kiloare (10 hectares) is not a bogus unit, although I've never seen it used. Hawkeye7 (discuss) 23:05, 24 January 2024 (UTC)[reply]
At https://iopscience.iop.org/article/10.1088/1681-7575/ac979f it nicely describes "the unit are, symbol a (for 100 m2) and the hectare, symbol ha (for 10 000 m2)". Later it mentions "centiare, ca (equal to 1 m2) or kiloare, ka (equal to 105 m2)". Personally, I have only ever seen hectare in the real world.
Similarly, I've never seen kiloannum in the real world but some web searching shows it being used on geology sites to mean millennium.  Stepho  talk  23:18, 24 January 2024 (UTC)[reply]
The second quote given by Stepho-wrs (talk · contribs) should be "centiare, ca (equal to 1 m2 or kiloare, ka (equal to 105 m2)." The author indicates the meaning of prefixed versions of the are are ambiguous, and the qoute given is one of four possible options. The author's recommendation is to add the hectare to the list of non-SI units with which SI prefixes may not be used, on the grounds that the are and multiples of that are rarely used, other than the hectare.Jc3s5h (talk) 02:39, 25 January 2024 (UTC)[reply]
I remember seeing kilohectares when a very large estate was described (presumably by someone who thought in acres). But at that level, square kilometer is more likely to be used. Tarl N. (discuss) 08:23, 25 January 2024 (UTC)[reply]
Example of such usage: Fuel characteristics and emissions from biomass burning and land-use change in Nigeria. Tarl N. (discuss) 08:29, 25 January 2024 (UTC)[reply]
Hawkeye7, it may not be exactly 'bogus', but it doesn't exist and is never used – it would have a side of 100√10 m, not a decimal measurement. The are is a measure of area, so possible/useable prefixes are in multiples of 100, not 10. Hectare, are, and centiare are used in cadastral measurement where I live; the next-largest (100 times greater) unit after the hectare would be the "myria-are" – more commonly known as the square kilometre. Justlettersandnumbers (talk) 21:24, 20 February 2024 (UTC)[reply]
Ping fail, sorry, missed the 7, Hawkeye7. Justlettersandnumbers (talk) 21:27, 20 February 2024 (UTC)[reply]

A possible improvement for the article would be to use one of the following which keeps the original input but does not display it:

  • {{convert|0.03|-|0.04|km3/ka|km3/km2 mi3/mi2|order=out}} → 0.30–0.40 cubic kilometres per square kilometre (0.19–0.25 cu mi/sq mi)
  • {{convert|0.03|-|0.04|km3/ka|km3/km2 mi3/mi2|abbr=on|order=out}} → 0.30–0.40 km3/km2 (0.19–0.25 cu mi/sq mi)

Johnuniq (talk) 00:46, 26 January 2024 (UTC)[reply]

No, because it's supposed to be kiloyear (->time) not kiloare (-> area). Jo-Jo Eumerus (talk) 16:33, 20 February 2024 (UTC)[reply]
I think the convert template has gotten out of control. I don't know what {{convert|0.03|-|0.04|km3/ka|km3/km2 mi3/mi2|order=out}} means, and I refuse to learn.
One of the purposes of the template is to eliminate the need for editors to look up conversion factors and calculate the conversion with a calculator. But in the case of this monstrosity, one would have to look up the conversion factors, calculate the conversion, and then try the convert template in a sandbox to see if the syntax is right and if indeed the template is right. This last step would probably take several tries. So using the template would be about five times harder than a manual calculation. Jc3s5h (talk) 16:33, 28 February 2024 (UTC)[reply]

Messy output for ranges mixing positive and negative values

In the Climate section for Pasadena, California, one can see the following text, which immediately struck me as difficult to read:

"...with the occasional reading in the 30s (−1–4 °C)."

The underlying conversion (which was not my work) is {{convert|30|-|39|F|C|disp=out}}

Shouldn't there be some sort of non-breaking space, or a spaced en dash? I suppose it could be reformatted to use "to", although that seems like it would be much less compact when compared to a simple spacing tweak, not to mention inelegant, having to reformat neighboring conversions (that otherwise look just fine) for the sake of consistency.

I'm not sure what the best approach is for this situation. Thanks! 1980fast (talk) 20:13, 27 January 2024 (UTC)[reply]

I don't think there is a good workaround other than using "to". The problem with that are the adjacent converts which use the same procedure but work with a dash. Johnuniq (talk) 00:57, 28 January 2024 (UTC)[reply]
Thanks! If anyone would know, it would be you. :) I will use "to" and not worry about it. 1980fast (talk) 03:46, 30 January 2024 (UTC)[reply]
I feel like this is a general range which is then converted with too much precision. I recommend writing ...with the occasional reading in the 30s (below 5 °C). instead, to convey the correct meaning. I like conversion templates as much as anyone here (except Johnuniq, perhaps), but there are times when they ought not to be used.  Mr.choppers | ✎  17:22, 28 February 2024 (UTC)[reply]

Decibels

Would it be useful to add (deci)bels? And/or normalized sound units like dB(A)? Doesn't look like this supports them unless I'm missing something. Actually ran into this while poking at {{val}}. Slowking Man (talk) 01:09, 29 January 2024 (UTC)[reply]

The decibel units are a mystery to most people. I don't know of anything useful they could be converted to. Johnuniq (talk) 05:36, 29 January 2024 (UTC)[reply]
Plain dB is probably not that useful, but there are ones like dBm, which is a power unit, dB relative to 1 milliwatt. It would need to know how to do log conversions, though. Gah4 (talk) 21:39, 20 February 2024 (UTC)[reply]

Typo in documentation?

There is a line that says:

"Remember that the spelling of the units (ft, m) is independently set by |abbr=."

Shouldn't that be:

"Remember that the spelling of the units (ft, m) is independently set by |sp=." ? 1980fast (talk) 22:25, 10 February 2024 (UTC)[reply]

That was added on 17 August 2014. Perhaps convert did not set abbr=on when spelling numbers at that time, so abbr=off would have made a difference? I could check that but it would take a while. Unless someone can think of what might have been intended, the simplest would be to delete the two lines. Johnuniq (talk) 02:49, 11 February 2024 (UTC)[reply]
I removed the old text at Template:Convert#Spell out numbers: ten miles so that is done. Johnuniq (talk) 02:19, 29 February 2024 (UTC)[reply]

Another mass unit

As British designations for truck/lorry capacities were often in hundredweight (cwt), could that be added as a unit? GraemeLeggett (talk) 09:51, 3 March 2024 (UTC)[reply]

Already there. {{convert|30|Lcwt|lb kg}} 30 long hundredweight (3,400 lb; 1,500 kg) -- WOSlinker (talk) 10:17, 3 March 2024 (UTC)[reply]
Thanks, couldn't see it in list, think I must have followed link to old documentation. Though doesn't seem to abbreviate {{convert|15|Lcwt|kg|abbr=on}} giving 15 long hundredweight (760 kg) rather than 15 cwt (660760 kg). GraemeLeggett (talk) 21:31, 3 March 2024 (UTC)[reply]
The full list at Module:Convert/documentation/conversion data#Mass includes -Lcwt and -Scwt (long and short hundredweight). The dash indicates that the unit is intended to be "internal", that is, used by convert for something involving cwt. Both these have cwt as the symbol and you can use them if really desirable. The point is that there is a difference between long and short and that is why it is included in the standard unit. Johnuniq (talk) 02:10, 4 March 2024 (UTC)[reply]

Fractional person?

Can this syntax be improved to avoid a fractional person?

  • {{convert|10|/m2|/ft2|spell=in|adj=pre|people}} (produces ten people per square metre (0.93/sq ft) )

Perhaps an option order=invert so that it produces 1.1 sqft/person? 𝕁𝕄𝔽 (talk) 20:47, 3 March 2024 (UTC)[reply]

In general there is nothing wrong, on the average, with a fractional person. That one is wrong because of SigFigs, not because of fractional persons. It should round to 1, and 10 has one significant digit. ten people per square metre (one per square foot) rounds to 1, which is probably about right. Also with spell=on so both get spelled out. (Seems fair to me.) Gah4 (talk) 00:34, 4 March 2024 (UTC)[reply]
Brothers and sisters! We should be uniting people, not dividing them! EEng 00:36, 4 March 2024 (UTC)[reply]
Yes, let us not be fractious. Hawkeye7 (discuss) 02:33, 4 March 2024 (UTC)[reply]
Did you mean facetious?
In this case, the issue can be ducked by using rounding but the general issue remains. 𝕁𝕄𝔽 (talk) 09:04, 4 March 2024 (UTC)[reply]
What general issue? EEng 13:06, 4 March 2024 (UTC)[reply]

Bug report: error in converting liters to US fl oz

The tool reports incorrect values:

4.0 litres (140 imp fl oz; 140 US fl oz)

This should be 135 US fl oz.

A conversion from 4 should be less than 4.05:

4.05 litres (143 imp fl oz; 137 US fl oz)


I'm not sure where else to report this. kslays (talkcontribs) 09:36, 7 March 2024 (UTC)[reply]

That is unfortunate but it happens because convert is guessing the number of significant figures in the input value. Convert does a good job most of the time but it fails in situations like this and the only cure is to specify the wanted precision. That is most easily done with a number that specifies the number of fractional digits after rounding, but sigfig and round are also options: see the rounding documentation on the template page and the first question in the FAQ at the top of this page. Johnuniq (talk) 10:29, 7 March 2024 (UTC)[reply]
That's very helpful, thanks. I was able to fix the article I was working on with sigfig, since I don't think round accepts a value to round to whole numbers. kslays (talkcontribs) 21:13, 7 March 2024 (UTC)[reply]
  • Too late now, but in retrospect a better design would have been to require specification of sigfigs or something. The guessing / default just causes too many headaches. EEng 22:02, 7 March 2024 (UTC)[reply]

Unitless numbers; %, ‰, ppm, ppb, etc.

I'd like to add unitless scales (%, ppm, ppb, etc.). Mostly this would be for thermal expansion coefficients. Sometimes people write "10.5 μin/(in⋅°F)", and I'd like to be able to convert it to

  • "18.9 ppm/°C" (preferentially)
  • "18.9 × 10−6/°C"
  • "18.9 μm/(m⋅°C)".

The latter one is actually pretty straightforward to add, I think. But the 1st two outputs don't seem possible at the moment. From what I can tell, {{convert}} needs an input unit and an output unit. Unit cancellation doesn't seem to be able to produce (or even consume) unitless values.

How can I specify 'ppm', 'ppb', etc., as unitless scale values (i.e., essentially equal to 10−6, 10−9, ...)?  — sbb (talk) 20:13, 24 March 2024 (UTC)[reply]