This is the talk-page for: Template:Convert/numdisp.

Purpose

edit

This template is used for numeric-display with the Template:Convert subtemplates, a tree of over 2,375 templates used to convert measurements, with numerous options. -Wikid77 (talk) 07:15, 8 October 2009 (UTC)Reply

Add typical category to template

edit

{{editprotect}} Please add the typical bottom category & "pp-template", like in the other 2,375 templates. WARNING: The <noinclude> tag must be appended on the SAME LINE as the template coding; otherwise an annoying line-break will be generated into several thousand articles.

<noinclude>
[[Category:Subtemplates of Template Convert]]{{pp-template|small=yes}}
</noinclude>

When creating a set of 2,376 templates, one always gets left out of the category. I hate it when that happens! -Wikid77 (talk) 07:15, 8 October 2009 (UTC)Reply

  Done, although Special:PrefixIndex/Template:Convert/ would seem to work as well as the category. — Martin (MSGJ · talk) 11:50, 8 October 2009 (UTC)Reply

Bypass Convert/numdisp/a to reduce 1 of 40 limit

edit

{{edit protected|Template:Convert/numdisp}} Replace Template:Convert/numdisp from {{Convert/numdisp/sandbox}}, which drops usage of the nested subtemplate {Convert/numdisp/a} and links to {Documentation} to show the new /doc subpage (for interwiki links).

IMPACT: 326,000 pages will reformat. {Convert/numdisp} has been the top 86th template in Wikipedia usage, as used in almost all cases of {Convert}. The helper {Convert/numdisp/a} has been the top 85th used, and will be dropped from almost all pages, after update here.
RISK: Low. {Convert/numdisp} is a simple template, despite all the HTML documentation comments, and merely branches to {{Convert/numdisp/fracparts}}, which mainly uses old template {{Convert/numdisp/frac1}} to format postive fractions.

The new Template:Convert/numdisp/sandbox contains a rewrite, of the template (see test-cases below), to always bypass subtemplate {Convert/numdisp/a}, as 1 less level of nested subtemplates. During 2009-2010, templates would die if used inside infoboxes or docpages, where total if-else/template nesting exceeded 40 levels deep. The original design of {Convert/numdisp} always invoked {Convert/numdisp/a}, to avoid 4 duplicate expressions of extracting {#titleparts:xx|1|2}. However, the new version has refactored those expressions to avoid using 4 duplicate expressions when checking for fractions, at the top level. After the update, for most conversions, {Convert/numdisp} will no longer invoke any other subtemplates (in 99.7% of all conversions), where {{Convert/numdisp/fracparts}} will only be invoked for numbers like "46+2/8". Examples (expecting identical results):

Number Convert/numdisp/sandbox Convert/numdisp
6+3/8 6 38 6 38
-6-3/8 −638 −638
32+1/4 32 14 32 14
-300-15/250 −30015250 −30015250
-15/250 15250 15250
3200 3,200 3,200
0 0 0
1/2 12 12
-1/2 12 12
101/2500 1012500 1012500

Embedded live use in {Convert}:

  • {{convert|2+4/5|mi|km}} → 2+45 miles (4.5 km)
  • {{convert|1/2|m|in}} → 12 metre (20 in)
  • {{convert|9+9/10|ft|m|3}} → 9+910 feet (3.018 m)
  • {{convert|1+61/100|km|mi}} → 1+61100 kilometres (1.00 mi)
  • {{convert|161+1/200|km|mi}} → 161+1200 kilometres (100.04 mi)

For more details, read the documentation inside Template:Convert/numdisp/sandbox, which explains how the parameters work with new subtemplate {{Convert/numdisp/fracparts}}, to avoid the fraction subtemplates for 99.7% of conversions. -Wikid77 (talk) 19 Nov., revised 04:37, 20 November 2010 (UTC)Reply

Done. As always, please revert and/or ping me if there is a problem. Thanks! Plastikspork ―Œ(talk) 03:13, 21 November 2010 (UTC)Reply
Okay, now not done. I tried it, but it screwed up the table above. I went back and forth a few times to try to find the problem, and then realized that the sandbox version was generating an extra newline somewhere. We didn't see it before, since the sandbox template was at the end of the line. Now, it's quite possible that this has no real impact to convert, but we should still try to fix it. I swapped the order of the templates in your table to show the problem. Thanks! Plastikspork ―Œ(talk) 03:27, 21 November 2010 (UTC)Reply
The history of /a is merged into the sandbox. JIMp talk·cont 01:47, 28 June 2011 (UTC)Reply

Update Convert/numdisp for minus sign

edit

{{edit protected|Template:Convert/numdisp}} 12-Feb-2011: Replace Template:Convert/numdisp from {{Convert/numdisp/sandbox}}, which now puts a Unicode minus sign "-" for negative numbers. The results have been tested to NOT put spurious newlines in amounts (see test-cases below).

IMPACT: Over 320,000 pages will reformat. {Convert/numdisp} has been the top 86th template in Wikipedia usage, as used in almost all cases of {Convert}.
RISK: Low. The change has been tested, and {Convert/numdisp} is a simple template, despite all the HTML documentation comments, and merely branches to {{Convert/numdisp/fracparts}}, which mainly uses old template {{Convert/numdisp/frac1}} to format postive fractions.

The Template:Convert/numdisp/sandbox contains the update, of the template (see test-cases below). Examples (expecting identical results, after update, with full minus signs):

Number Convert/numdisp/sandbox Convert/numdisp
-7 −7 −7
-270.55 −270.55 −270.55
-2400500 −2,400,500 −2,400,500
6+3/8 6 38 6 38
-6-3/8 −638 −638
32+1/4 32 14 32 14
-15/250 15250 15250
3200 3,200 3,200
-3200 −3,200 −3,200
0 0 0
-1/2 12 12

Embedded live use in {Convert}:

  • {{convert|2+4/5|mi|km}} → 2+45 miles (4.5 km)
  • {{convert|1/2|m|in}} → 12 metre (20 in)
  • {{convert|9+9/10|ft|m|3}} → 9+910 feet (3.018 m)
  • {{convert|1+61/100|km|mi}} → 1+61100 kilometres (1.00 mi)
  • {{convert|161+1/200|km|mi}} → 161+1200 kilometres (100.04 mi)

For more details, read the documentation inside Template:Convert/numdisp/sandbox, which explains how the parameters work. -Wikid77 (talk) 01:04, 12 February 2011 (UTC)Reply

Done. As always, let me know (and revert) if there is a problem. Thanks! Plastikspork ―Œ(talk) 01:30, 12 February 2011 (UTC)Reply

Fix Convert/numdisp for trailing zeroes

edit

{{edit protected}}
16-Feb-2011: Replace Template:Convert/numdisp from {{Convert/numdisp/sandbox}}, to re-add trailing zeroes when &minus sign is used. This a better emergency fix, to fix the prior fix. More results have been tested, to NOT drop end-zeroes, and NOT put spurious newlines (see test-cases below).

IMPACT: Over 339,000 pages will reformat. {Convert/numdisp} has been the top 90th template in Wikipedia usage, as used in almost all cases of {Convert}.
RISK: Low. The change has been tested with a far wider range of numbers, to help detect any other problems when formatting unusual numbers.

The Template:Convert/numdisp/sandbox contains the update, of the template (see test-cases below). Examples (expecting identical results, after update, with full &minus signs, except -0.0):

Number Convert/numdisp/sandbox Convert/numdisp
-7 −7 −7
-270.5500 −270.5500 −270.5500
-14000.00000 −14,000.00000 −14,000.00000
-14000.00300 −14,000.00300 −14,000.00300
000.00400 000.00400 000.00400
270.44000 270.44000 270.44000
-0.000 −0.000 −0.000
-2400500 −2,400,500 −2,400,500
6+3/8 6 38 6 38
-6-3/8 −638 −638
-15/250 15250 15250
3200 3,200 3,200
-3200 −3,200 −3,200
0 0 0
-1/2 12 12

Embedded live use in {Convert}:

  • {{convert|2+4/5|mi|km}} → 2+45 miles (4.5 km)
  • {{convert|4.500|m|in}} → 4.500 metres (177.2 in)
  • {{convert|9+9/10|ft|m|3}} → 9+910 feet (3.018 m)
  • {{convert|1+61/100|km|mi}} → 1+61100 kilometres (1.00 mi)
  • {{convert|161+1/200|km|mi}} → 161+1200 kilometres (100.04 mi)

For more details, read the documentation inside Template:Convert/numdisp/sandbox, which explains how the parameters work. -Wikid77 16:36, 17 February 2011 (UTC)Reply

Done. Thanks! Plastikspork ―Œ(talk) 19:59, 17 February 2011 (UTC)Reply

E notation

edit

Wouldn't it be nice if we could get this to convert e-notation into words and/or standard scientific notation? ∃ a request @ talk pertaining to this. Maybe something like "e"s in "×10"s and strings of zeros into "~illions". JIMp talk·cont 06:15, 17 May 2011 (UTC)Reply