Jump to content

Template talk:Km2 mi2

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

Discrepancy between Template:Km2 mi2 & Template:Convert

[edit]

@Wizmut, Plastikspork, MJCdetroit, Orderinchaos, Johnuniq, and WOSlinker: I noticed that there appears to be a discrepancy between these two templates.

Code: {{km2 mi2|300000}}
Result: 300,000 (100,000)
Code: {{convert|300000|km2|sp=us|0}}
Result: 300,000 square kilometers (115,831 sq mi)

As a former coder, I suspect the inaccuracy lies with the {{km2 mi2}}. My simple reasoning is that {{convert}} clearly has had many more eyeballs on it.

I questioned myself why we need {{km2 mi2}} when we have {{convert}}. I think that Wizmut created a template devoid of units for display & sorting purposes. In the article namespace, {{km2 mi2}} is currently used on List of countries and dependencies by area, List of South American countries by area, & List of North American countries by area. In each of these three articles, the units are listed as in km2 (mi2) in the column headings instead of putting them inside the individual table cells with the individual area values.

{{convert}} does have a parameter to make values suitable for a sortable table, |sortable=on. The template also has a method of only displaying the numerical output without the unit of the conversion, |disp=number.

Given that {{km2 mi2}} seems to returning inaccurate results, I am wondering if it would be better to recode this template so that it passes the results to {{convert}} or to delete this template altogether & replace it with {{convert|<value>|km2|sqmi|sp=us|disp=number|sortable=on|0}}.

This is my version of the code that would produce the same formatted result as {{km2 mi2|300000}} but corrected numerically. Perhaps someone else could do it more elegantly.

Code: 300,000 ({{convert|300000|km2|sqmi|disp=number|sortable=on|0}})
Result: 300,000 (115,831)

Peaceray (talk) 20:58, 13 August 2024 (UTC)[reply]

I don't feel like decoding what {{km2 mi2}} does to work out what's going on but it's likely that this example is due to rounding. The above convert has parameter |0 which rounds the output to zero decimal places. That shows all digits before the decimal point. What links here shows {{km2 mi2}} is used in articles List of countries and dependencies by area + List of South American countries by area + List of North American countries by area. Johnuniq (talk) 21:40, 13 August 2024 (UTC)[reply]
That Philippines measurement is my least favorite of any of the obviously inaccurate country statistics. The page for Philippines arbitrarily uses 2 sig figs. The big area list arbitrarily uses 1, and as you say Geography of the Philippines arbitrarily uses 6. It's hard to find any source that doesn't use this wild guess of "300,000 km2".
Some academic sources give much larger numbers closer to 350,000 km2. And I can't find the links but an ARCGIS measurement gave a number much lower than 300,000 for land area (CIA current figure chops some internal water off of "three hundred large"). Point is, I don't think any official body has cared to check what the actual area is, and the CIA/UN statistic is unlikely to change, possibly for reasons related to the South China Sea dispute.
For the template, I wouldn't oppose any change to make it more like 'convert' - so long as we know how many sig figs we should use. The purpose of the template was to make the wikicode easier to proofread without changing the table content. Compare
| {{nts|114}} || {{flag|United Arab Emirates}} || {{km2 mi2|83600}} || {{km2 mi2|82880}} || {{km2 mi2|720}} || 0.9 ||
with
| {{nts|114}} || {{flag|United Arab Emirates}} || {{convert|83600|km2|sqmi|abbr=values|sortable=on}} ||{{convert|82880|km2|sqmi|abbr=values|sortable=on}} || {{convert|720|km2|sqmi|abbr=values|sortable=on}} || 0.9 ||
and tell me the third number used in each. No wonder the table was full of unsourced numbers until recently. Wizmut (talk) 21:42, 13 August 2024 (UTC)[reply]
Why is there absolutely no template documentation? Shame on the author for that.
if you want an exact match to the {{convert}} rendering:
{{km2 mi2|300000|6}} → 300,000 (115,831)
Trappist the monk (talk) 21:48, 13 August 2024 (UTC)[reply]
Shame's on me - I'm the author. Was my first template, made to help me to proofread every number on List of countries and dependencies by area more painlessly. Wizmut (talk) 22:07, 13 August 2024 (UTC)[reply]
Wizmut, would you please:
  1. Add the template documentation.
  2. Either fix the template or the use of the template code so that we are seeing values that are only rounded to the closest whole number.
I really do not care about the accuracy of the Philippines measurement in km2; what I care about is the accurate conversion of 300,000 km2 to 115,831 mi2. Please see Talk:List of countries and dependencies by area#Semi-protected edit request on 13 August 2024 Peaceray (talk) 05:19, 14 August 2024 (UTC)[reply]
Wizmut is implying above that the 300,000 number is vague and that converting it to a precise number of square miles would give false precision. That needs to be investigated and fixed for consistency. Johnuniq (talk) 05:30, 14 August 2024 (UTC)[reply]
That may be true, but inconsistency with {{convert}} leads to inconsistent results between articles, which confuses readers. Please see Talk:List of countries and dependencies by area#Semi-protected edit request on 13 August 2024. It is better if we stay consistent with how we convert values across templates. Peaceray (talk) 05:38, 14 August 2024 (UTC)[reply]
If a value is approximate, perhaps it can then be noted somewhere in the table row with an {{Explanatory footnote}}. Peaceray (talk) 05:46, 14 August 2024 (UTC)[reply]