Jump to content

మూస చర్చ:Infobox settlement/areadisp

ఈ పేజీ లోని కంటెంటులకు ఇతర భాషలలో మద్దతు లేదు.
వికీపీడియా నుండి

Removal of cases from switch

[మార్చు]

The 5 templates "mentioned" in the switch statement are actually being "used", I.E. transcluded in every article that has both kn and mi, up to 7 time for a maximum of 35 top level transclusions per page, but up to 3 or more times that as at least the following are called:

  1. Template:Country data USA (edit) (protected)
  2. Template:Country data United Kingdom (edit) (protected)
  3. Template:Country data United States (edit) (protected)
  4. Template:Country flag2 (edit) (protected)
  5. Template:Country flagicon2 (edit) (protected)
  6. Template:CountryAbbr (edit) (protected)
  7. Template:Flag (edit) (protected)
  8. Template:Flagicon (edit) (protected)
  9. Template:UK (edit) (protected)
  10. Template:USA (edit) (protected)

Given an occurrence of items that transclude this page is about 100,000 this is a high cost. The number of "badly formed" articles is about 3000, I porpose to add unit_pref = Imperial to these articles, where they don't already have it (which will be most cases), and remove the template matches. I could fix up the subdivison_name, but it would be swimming through treacle. Rich Farmbrough, 05:48, 1 May 2010 (UTC).

If you have the time and patience to do it, then go for it. By the way, there was some resistance to the use of the word "Imperial" for feet and square miles, since Imperial units is something else. I believe we have an alternative name? Plastikspork ―Œ(talk) 15:08, 1 May 2010 (UTC)

Zero acres returned when ha is 1 or 10 or 100 (may be other instances)

[మార్చు]

Hard (impossible!) to know where it's going wrong. Could be in the precision.
As a matter of interest, why is #expr used rather than convert - that will do everything in one line - conversion from any to appropriate units, with display, and rounding? Johnmperry (talk) 01:01, 15 November 2012 (UTC)

the problem is with using template:precision, see Template talk:Precision#Bug?. I have asked for help from someone who knows that template. Frietjes (talk) 01:18, 15 November 2012 (UTC)
{{convert}} is both expensive and slow - it's easy to take the page beyond the template limits with just one apparently-simple calculation. I have seen the transclusion depth of a page change by about fifteen levels by the simple addition of one parameter to {{convert}}. Where the units to convert from and to are known in advance, and are unlikely to change, the parser function {{#expr:}} is far more efficient. --Redrose64 (talk) 09:57, 15 November 2012 (UTC)
I don't understand why on line 46 the precision of the input is reduced on output. Why wouldn't we want both the same? (particularly since acres are smaller than hectares). I don't know how to test this (nor want to know). Other cases also invoke Order of magnitude, but that seems to be inferring that an input which is an exact multiple of 10 (100, 1000 ...) has already been rounded by inputter. Kind of second-guessing.
And from an efficiency point of view, isn't division much slower (hungrier) than multiplication? So why is the input divided by a constant rather than multiplied by one? Johnmperry (talk) 00:37, 16 November 2012 (UTC)
The difference between relative speeds of mathematical operators is negligible compared to the time spent expanding templates and parsing parameters. I'm going to drop a note on Script error: No such module "user". who wrote most of this. --Redrose64 (talk) 09:55, 16 November 2012 (UTC)
yes, the issue is definitely with parsing/expanding the expressions. the cost of a flop is going to be nothing compared the the cost of the text processing. and, we aren't really concerned about "cost" as we are with the limits imposed by MediaWiki on expression depth. we should see how expensive this template is compared to convert though to assess if switching to convert is feasible. Frietjes (talk) 21:16, 16 November 2012 (UTC)
It was over-rounding the conversion. It's fixed. JIMp talk·cont 02:36, 17 November 2012 (UTC)

Edit request: Fix over-rounding in conversion of square miles to km2

[మార్చు]
Infobox settlement
విస్తీర్ణం
 • City10,000 చ. మై (30,000 కి.మీ2)
 • Land1,000 చ. మై (3,000 కి.మీ2)
 • Water100 చ. మై (300 కి.మీ2)
 • Urban
10 చ. మై (30 కి.మీ2)
 • Rural
1 చ. మై (3 కి.మీ2)
 • Metro
0.1 చ. మై (0.3 కి.మీ2)
 • blank10.01 చ. మై (0.03 కి.మీ2)
 • blank20.001 చ. మై (0.003 కి.మీ2)

While updating the documentation for this template, I noticed it is over-rounding the conversion of square miles to square kilometres, such that an area of 10,000 sq mi displays 0 km2 as the conversion (see examples to the right). This is similar to the recently fixed problem with conversion of hectares to acres and can be fixed the same way, by removing "-1" in the following portion of Template:Infobox settlement/areadisp:

|{{rnd<!-- convert square miles to square kilometres -->
   |{{#expr:{{formatnum:{{{sqmi}}}|R}}*2.589988110336}}
   |({{precision|{{formatnum:{{{sqmi}}}|R}}}}-1)
 }}<!-- end rnd -->

I have implemented the suggested correction at Template:Infobox settlement/areadisp/sandbox (diff) and provided multiple test cases at Template:Infobox settlement/areadisp/testcases. -- Zyxw (talk) 00:19, 5 February 2013 (UTC)

Done! Plastikspork ―Œ(talk) 00:04, 17 February 2013 (UTC)
Thanks! -- Zyxw (talk) 10:25, 17 February 2013 (UTC)

గతంలో పనిచేసిన రూపం

[మార్చు]

[1] తెలుగులో చివరి పనిచేసిన రూపం--అర్జున (చర్చ) 05:35, 12 ఏప్రిల్ 2019 (UTC)[ప్రత్యుత్తరం]