Template talk:Convert/Technical/Archive 2009

=Convert/and/in= This is the talk-page for: Template:Convert/and/in.

Created
The conversion-subtemplate Template:Convert/and/in was created by long-term user Jimp on 13 December 2007, to support 2-unit conversions for the standard Template:Convert. This template handles conversion of "and-inches" when invoked from the 1st-unit subtemplate, such as Convert/ft for combined ft-and-inches. Wikid77 20:29, 31 October 2009

Output precision to match input precision
editprotect 31-Oct-09: Inside of Template:Convert/and/in, the precision-parameter "j" must auto-adjust as -2 for proper rounding with cm or metres. The template coding-logic to auto-adjust "j" is shown below: A version under Template:Convert/and/in/sandbox contains that logic to auto-adjust the precision to match the input amount's 1-inch precision. That version focuses only on setting the precision-parameter "j" so that ft/inches-to-cm or ft/inches-to-metres (etc.) will display with appropriate precision. Some examples are listed in the table (at right).
 * j=-2+

The rationale for the more-precise rounding is simple: the default precision of the output must match the input precision, so for units "and-inches", the output-rounding must be within 1 inch (within 2.54 cm, or .0254 metre). In general, for calculations made by Template:Convert, the precision of the resulting amounts is typically intended to match the input precision. For the input "units-and-inches", the precision is to the nearest inch, with 2.54 cm (or 0.0254 metre). For that reason, when the output is centimetres, the number should be rounded to within 2.54 cm (not to the nearest 10, which would be nearly 4 inches). Similarly, when the result is in metres, then the precision should be rounded to the nearest 0.0254 metre, requiring a default display of 2-decimal places (x.xx m), because 1-decimal precision is only 0.1 m = 3.937 inches (not the 1-inch precision of the input).

Scope of problem: An example of an extreme result can be seen with 5 ft 1 inch formerly converted as 150 cm (should be 155), when 4 ft 11.0 is 4 ft/sandbox, so the conversion (for 5 ft 1 in) was then off by 5 cm or 2 full inches, not within the 1-inch precision of the input.

The version under Template:Convert/and/in/sandbox contains the logic to auto-adjust the precision to match the input amount's 1-inch precision. That version focuses only on setting the precision-parameter "j" so that ft/inches-to-cm or ft/inches-to-metres will display with appropriate precision. -Wikid77 (talk) 20:33, 31 October 2009 (UTC)
 * ✅ —Th e DJ (talk • contribs) 14:37, 1 November 2009 (UTC)
 * On this Sunday, I and 19,276 Wikipedia articles/pages thank you. Within 2 hours, many of those 19,000 articles have been reformatted to reflect the improved conversion. Thanks again. -Wikid77 (talk) 16:54, 1 November 2009 (UTC)

=Convert/Dual/LoffAoffDsSon= This is the talk-page for: Template:Convert/Dual/LoffAoffDsSon.

Created
The conversion-subtemplate Template:Convert/Dual/LoffAoffDsSon was created (but never finished) by long-term user Jimp on 1 May 2008, to support output formatting for the standard Template:Convert, during the initial 8-month development of Template:Convert. This template sets the format for "disp=s" to show the input unit-range, plus the results after a slash, as non-wikilinked, abbr=off, but hyphenated for adjective-mode display. -Wikid77 (talk) 20:41, 5 November 2009 (UTC)

Removing bug: H=metre
05-Nov-09: Because the template was never finished, it displayed an extra "H=metre" in the middle of the results, and then became edit-protected. To operate correctly, it should contain the exact same contents as the equivalent Template:Convert/Dual/LoffAoffD/Son (because the name-codes "Ds" and "D/" are both for slash-separated output). The 2nd template was developed more recently, in November 2009.

When operating properly, the "Expected" & "Current" results should match:


 * Expected: 10 by gives: 10-by-20-metre / 33-by-66 ft
 * Current : 10 by gives: 10 by


 * Expected: 4 by gives: 4-by-8-metre / 13-by-26 ft
 * Current : 4 by gives: 4 by


 * Expected: 1.5 by gives: 1.5-by-3.5-metre / 4.9-by-11 ft
 * Current : 1.5 by gives: 1.5 by


 * Expected: 6 to 7 m gives: 6-to-7-metre / 600-to-700 cm
 * Current : 6 to 7 m gives: 6 to 7 m

The template is rarely used, so few users have been affected. -Wikid77 20:55, 5 November 2009
 * To reduce the chance of errors, please could you put the exact code you require in Template:Convert/Dual/LoffAoffDsSon/sandbox? &mdash; Martin (MSGJ · talk) 15:49, 6 November 2009 (UTC)