Template talk:Convert/Archive May 2013

Weird Result
152.4 m produces the strange result: 152.4 m (0×10−13 in). Change the input value to 152, 152.3 or 152.5 and things are fine! CrackDragon (talk) 01:29, 2 May 2013 (UTC)
 * Interesting, the programmer's nightmare! I've had a look, but it is too tricky for me. It is not the ; it is the fact that the input converts to exactly 500 feet, and somehow the 500 is being interpreted as zero, which causes it to be omitted. The same thing happens with other combinations:
 * → 152.4 m
 * → 304.8 m
 * → 3,175.14659 kg
 * → 0.22321428571429 LT
 * Johnuniq (talk) 09:22, 2 May 2013 (UTC)


 * Problems with 2-unit values near zero units: Due to truncation error in storage of floating-point numbers, the calculations must be shifted by tiny amounts to avoid errors in the 13th or 14th decimal digit. Until fixed, just append the trailing digits "001" such as "152.4`001" and use Template:Convert/f to show only the original one-decimal precision by "r1=1" as follows:
 * → 152.3 m
 * → 152.4 m
 * → 152.4000 m
 * → 152.4001 m
 * → 152.4 m
 * → 500.000 ft
 * Even after Template:Convert/LoffAonSoffAnd has been fixed, the use of {convert/f} will still show the correct results, so there will be no need to redo the fixed conversions in whichever articles. -Wikid77 (talk) 14:04, 2 May 2013 (UTC)
 * Even after Template:Convert/LoffAonSoffAnd has been fixed, the use of {convert/f} will still show the correct results, so there will be no need to redo the fixed conversions in whichever articles. -Wikid77 (talk) 14:04, 2 May 2013 (UTC)


 * Fix {Convert/rand} to use #expr "round" not {rnd}: The Template:Convert/rand/sandbox should be used to update {Convert/rand}, to just round the output amounts by using a simple #expr with "round" rather than use Template:Rnd which puts scientific notation of x10 span-tags in tiny values near zero. Instead, a simple #expr rounding will keep all internal values as simple numbers. So there will be no x10 data such as "0&times;10-13" in the numbers to format for ftin, lboz, or stlb, etc. Note the use of {convert/rand/sandbox} by "ftin/sandbox2" as the unit-code, to allow a clean conversion of 152.4 m as 500 feet (not "0 &times; 10-13"):
 * {convert|152.4|m|ftin}}   &rarr; 152.4 m
 * {convert|152.4|m|ftin/sandbox2}} &rarr; 152.4 m
 * → 304.8 m
 * → 304.8 m
 * Other problems with using Template:rnd, to round the intermediate results, have been noted for years, and we need to format the x10 notation (or trailing ".000") only in the final results. However, for "ftin" or "lboz" the trailing ".000" could be ignored for now. -Wikid77 (talk) 15:54, 2 May 2013 (UTC)


 * There is another solution. It is much easier to be consistent and accurate when using one Lua module (see Module talk:Convert for progress, and see here for some other template problems).
 * Following are the results using the module:
 * Johnuniq (talk) 23:52, 2 May 2013 (UTC)
 * Johnuniq (talk) 23:52, 2 May 2013 (UTC)
 * Johnuniq (talk) 23:52, 2 May 2013 (UTC)
 * Johnuniq (talk) 23:52, 2 May 2013 (UTC)
 * Johnuniq (talk) 23:52, 2 May 2013 (UTC)

Kelvin
Just wondered if there is a way to easily convert 5 degrees above absolute zero into both centigrade and Fahrenheit using this template ? EdwardLane (talk) 07:33, 2 May 2013 (UTC)
 * → 5 K
 * Since Celsius + Fahrenheit is the default, you can also have:
 * → 5 K
 * Johnuniq (talk) 08:08, 2 May 2013 (UTC)
 * thanks EdwardLane (talk) 14:41, 3 May 2013 (UTC)

Problems with separation of Number from Units of Measurement at End of a Text Line.
75 ft - It would be helpful if all conversion templates could be updated to avoid the first cited units of measurement from being separated from the number at the end of the line. When manually entering it, it would be accomplished by inserting "&" followed by "nbsp;" between 75 and "feet" in the example. However, the current template allows the 75 and "feet" to be separated at the end of the line. The template does allow the second conversion units, which in the example is meters, and number to stay together if it goes over the cliff at the end of a line.

The first number and unit of measurement is kept together when going over the cliff at the end of a line when adj=on is added, as shown in this example, 75 ft, but that is only when it is used in the context of an adjective.

Let me know if anything can be done to correct this.Wondering55 (talk) 15:54, 7 May 2013 (UTC)
 * Using a space between the value and the name of a unit was a design decision, although some templates have, while most use a space. Abbreviated units (symbols) are preceded by  . Use nowrap for an exception like a conversion at the end of a line , as done here:
 * Padding to test wrap aaaaaaaaaaa bbbbbbbbbbb ccccccccccc aaaaaaaaaaa bbbbbbbbbbb 75 ft.
 * Johnuniq (talk) 00:26, 8 May 2013 (UTC)
 * Thanks for the workaround advice. Is there any way to get someone to agree to change the design decision in order to eliminate this spacing problem for the first number and the fully spelled out unit of measurement. I would think that most editors would not like to see a number and its associated unit of measurement be separated at the end of a line. There is no problem with spacing when abbr=on is used with the template, 75 ft, since the first units are then abbreviated, and the template is set up so that abbreviated units do not get separated from a number. There is no problem with spacing when adj=on is used since a hyphen is placed between the number and the unit of measurement. By default, there is no problem with the secondary converted number and unit of measurement, which is abbreviated in all cases, regardless of whether abbr=on or adj=on is used.Wondering55 (talk) 04:50, 8 May 2013 (UTC)
 * there used to be an option (was it called mos?) which would add a non-breaking space exactly where you indicated, but that was removed. Frietjes (talk) 14:43, 8 May 2013 (UTC)
 * One previous discussion was in March 2012. However the abbr=mos option was removed with the rationale that the convert template should conform to MOS by default (see edit summary here). Johnuniq (talk) 02:39, 9 May 2013 (UTC)


 * There were problems in narrow wikitable columns which needed wrapping: Some longer unit names (such as "square inches") need to wrap, when inside narrow columns. So, the default spacing has been set to allow full text-wrap of the input amount, where only an abbreviated unit symbol forces a non-breaking space (&amp;nbsp;) after the numeral. The wikitable, at right, contains 2 conversions, which allow the numeral and unit name to wrap:
 * 75 ft &rarr; 75 ft
 * 19.7 sqin &rarr; 19.7 sqin
 * However, we could have a new option to join (no-wrap) the original amount and the unit name. Then, a numeral would always join as "19.7 square" within a line of text. Every year, someone raises the text-wrap issue, so I think it is time to find a workable solution. I guess it can be frustrating for people who do not know about the narrow-column cases in wikitables. -Wikid77 (talk) 08:19, 9 May 2013 (UTC)
 * OK. This would definitely get to a preferred workable solution, which really is needed by editors for all Wikipedia articles. The narrow-column case with a no wrap solution for the first full word in a unit of measurement can easily be addressed by slightly increasing the allowed width of that particular narrow-column, which is arbitrary for a particular article. Can anybody provide a link to a particular article that is so narrow that only the text for a number and the full first word of the unit of measurement cannot fit on one line? That would be one very narrow column, which I assume could easily be widened.Wondering55 (talk) 14:47, 9 May 2013 (UTC)
 * There have been some scientific data tables, perhaps some numbers such as: 1.234455 ly where "light-years" would wrap underneath the number. With over 530,000 affected articles, it has been difficult to keep track of usage. -Wikid77 16:35, 9 May 2013 (UTC)


 * New option "adj=j" to join amounts to units: This new option "adj=j" will join the amount+unit for cases such as "9&amp;nbsp;miles" within the text (compared to adj=on showing "9-mile"). Any multi-word units, such as "square inches" units, will still wrap, to avoid excessive rigid text. So, the default spacing will allow full text-wrap of the input amount, but "adj=j" will join numeral and unit. The wikitables, at right, contain 2 conversions, which show how the numeral and unit name will stay joined (not wrap):
 * 530,120 mi &rarr; 530,120 mi
 * 297 ft &rarr; 297 ft
 * The option "adj=j" is a first step, and we can develop better options later. However, a new option was needed immediately, because this text-wrap issue has been discussed every year, and we needed a workable solution. Now we have a way to join number+unit, while allowing full wrap in wikitables. I think this option was overlooked by us part-time volunteers, for years, due to distractions of handling 74,000 other combinations of options, with over 350 measurement units. I guess we need to have some way to sort out priorities, of which options affect more conversions, such as issues re-discussed every year, to focus on major improvements. -Wikid77 16:14, 9 May 2013 (UTC)

One item to note about using nowrap with this template: the line then won't/can't break between the input value and the conversion in parentheses. For example, enclosing 60 mi in the nowrap template means that the whole "60 miles (97 km)" grouping will appear on the same line, even though it would be desirable to allow the line to break between the mils and the kilometers.  Imzadi 1979  →   17:28, 9 May 2013 (UTC)


 * Happy Days are here again. Go forth and spread this good news/option. I assume the explanation and details for this new option will be put on the Template: Convert page. Thanks for listening and coming up with a needed solution.Wondering55 (talk) 20:47, 9 May 2013 (UTC)

While I was updating articles with the new command adj=j, it worked great, except for Convert templates that also had the disp=flip command, which currently works when abbr=on or adj=on is used, i.e. 4543.5 m. Can someone update the Convert template with the disp=flip command so that it also works with adj=j? Wondering55 (talk) 15:25, 12 May 2013 (UTC)
 * fixed? Frietjes (talk) 19:15, 12 May 2013 (UTC)
 * Thanks, it now works with disp=flip as shown: 4543.5 mWondering55 (talk) 14:14, 13 May 2013 (UTC)

For locomotives
ton-force (short), ton-force (long) ton-force (short), ton-force (long) long ton force (LTf) long tons-force for |locobrakeforce =, see British Rail Class 13 etc. See Talk:Ton. Peter Horn User talk 02:54, 13 May 2013 (UTC)
 * The reverse would be 370 kN. Peter Horn User talk 16:16, 13 May 2013 (UTC)
 * Make that 370 kN. Peter Horn User talk 16:19, 13 May 2013 (UTC)
 * which units do you actually need, we have STf, LTf, and kN, so which one is missing? Frietjes (talk) 16:29, 13 May 2013 (UTC)
 * Or reverse 370 kN also 370 kN or 370 kN. LTf and STf are "missing" only in the sense that long tons-force (LTf) and short tons-force (STf) as in the current etc all misdirected to ton instead of being treated as a unit of pressure. Peter Horn User talk 16:43, 13 May 2013 (UTC)
 * I see, please correct the requests made at Template talk:Convert/STf and Template talk:Convert/LTf if I got it wrong. Frietjes (talk) 16:59, 13 May 2013 (UTC)

✅ Peter Horn User talk 22:04, 13 May 2013 (UTC)
 * LTf and STf or LTf and STf should have their own articles just as lbf. Peter Horn User talk 15:43, 14 May 2013 (UTC)
 * Removed that which did not belong here. Peter Horn User talk 04:56, 18 May 2013 (UTC)

Pluralising m/s
I am having some problems using the template with m/s. 750 m/s displays rather than "metres per second". Can anybody help me? --John (talk) 12:08, 26 May 2013 (UTC)
 * I've fixed it. 750 m/s -- WOSlinker (talk) 12:34, 26 May 2013 (UTC)
 * Thank you, that was fast. --John (talk) 12:36, 26 May 2013 (UTC)

Incorrect conversion of kg to lbs/rounding lb to 2 significant digits by default
All over the Wikipedia, so the formula (1 kg = 2.2 lb) must be screwed up in the template, e.g. 70 kg = 154 lb, but the template wrongfully produces 70 kg, 62 kg = 136 lb, but the template wrongfully produces 62 kg, but it converts correctly 100 kg, 10 kg, and 1 kg; it seems it rounds lb to 2 significant digits, which is a primitive default especially for the people's weight template, and, instead, it should be accurate by default.--24.186.223.176 (talk) 19:44, 25 May 2013 (UTC) 70 kg


 * The template tries to keep the rounding the same as the number of zeroes in the input. But you can override it:
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg
 * 70 kg → 70 kg  Stepho  talk 00:23, 26 May 2013 (UTC)


 * Not really, as 62 does not contain zeros, but 140 does; the conversion default is inaccurate, arbitrary, primitive, and results in inaccurate and thus misleading weight of almost all people described on Wikipedia contradicting its essence and purpose:
 * 62 kg → 62 kg. --24.186.223.176 (talk) 03:47, 27 May 2013 (UTC)


 * Hmm, curious. I'm not sure why it rounded off to an extra digit but you can always override it. To give some more examples with your new numbers:
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg
 * 62 kg → 62 kg  Stepho  talk 04:25, 27 May 2013 (UTC)


 * The under-precision of kg/lb conversions was to be fixed years ago with m/ft: Sorry, this is another drop-the-ball lack of fixing a massive problem noted years ago. It is related to the fix for m/ft as in: 32 m. Please understand, with all the other problems and troublemakers who distract from important changes, then these major problems sometimes (often) get unresolved for years. Some similar cases:
 * 59 kg  &rarr; 59 kg
 * 60.5 kg &rarr; 60.5 kg
 * 61 kg  &rarr; 61 kg
 * 61.5 kg &rarr; 61.5 kg
 * 62 kg  &rarr; 62 kg
 * 62.5 kg &rarr; 62.5 kg
 * 63 kg  &rarr; 63 kg
 * 63.5 kg &rarr; 63.5 kg
 * 64 kg  &rarr; 64 kg
 * In general, the default precision of the output amount should be sufficient to differ in amount so that the amount (n - 0.5) does not convert higher than the higher amount n, such as 60.5 kg as "133 lb" but 61 kg as "130 lb" (oops!). It was a major problem with m-to-ft conversions having a conversion factor of ~3.28, and also a problem with kg-to-lb as the conversion factor of ~2.2 gives some numbers which are particularly prone to folding into the same output amount, for 2 different input amounts, or else the higher amount yields a lower result (oops!). It should have been fixed 4-5 years ago, so thank you for noting the severe problem still exists. A fix similar to the default-precision fix for "ft" (fixed in Template:Convert/ft) would correct the kg-to-lb problem. So then, update Template:Convert/lb to reset precision parameter "j" as:
 * Bad: |j=-0.343334259-
 * Fix: |j=
 * As shown in the Template:Convert/lb/sandbox version:
 * {convert|60.5|kg|lb/sandbox} &rarr; 60.5 kg
 * {convert|61|kg|lb/sandbox}  &rarr; 61 kg
 * {convert|61.5|kg|lb/sandbox} &rarr; 61.5 kg
 * {convert|62|kg|lb/sandbox}  &rarr; 62 kg
 * {convert|62.5|kg|lb/sandbox} &rarr; 62.5 kg
 * {convert|63|kg|lb/sandbox}  &rarr; 63 kg
 * {convert|63.5|kg|lb/sandbox} &rarr; 63.5 kg
 * That was intended to be the fix 4-5 years ago. -Wikid77 (talk) 23:24/23:40, 27 May, 03:56, 29 May 2013 (UTC)

Interesting—thanks for the explanation. I knew about the extra precision with ft and integer input, but I was not aware of the background. However, there may not be a convenient procedure that always works. Consider: The difference between the exact and rounded outputs is generally under 0.4 in that region, but the difference jumps to 43.2 when the input is 700. However, that's a reasonably small error of 43.2/1543 = 2.8%, although it looks dramatic. I used a script hacked from Module:Convert to find that number, which is the biggest difference for inputs from 0 to 1000 with kg/lb.
 * → 699.2 kg
 * → 699.6 kg
 * → 699.8 kg
 * → 700 kg
 * → 700.2 kg

In the same range, the worst case for m/ft is at 900 where the output jumps up by 48: Module:Convert has the same problem; I'll think about whether anything can be done, but it looks tricky. Johnuniq (talk) 10:24, 29 May 2013 (UTC)
 * → 899.6 m
 * → 899.8 m
 * → 900 m
 * → 900.2 m


 * Treating one zero as significant digit per number sense: Yes, now I am remembering years ago, as some solved the major cases by treating one trailing zero as significant for some units of measurement, depending on "number sense" in cultural usage. For example, if someone in the U.S. says, "We got a speeding ticket for going 40 mph in a 35 zone" then that 40 mph was clocked between 39.5-40.5, rather than 1 significant digit rounded between 35-45. So, the "900" would be treated as "90" with sigfig=2 (rather than 1 digit):
 * &rarr; 900 m
 * &rarr; 900.2 m
 * Hence, "900 m" is properly "(3,000 ft)" because a survey of usage in articles will confirm how "700" or "900" is used to indicate "roughly 900" and the rough result "3,000&#160;ft" is entirely sensible in actual usage. It works well because almost no hill is exactly 900. m and almost no road is exactly 700. mi. However, having "62&#160;kg (140&#160;lb)" then 62.5 kg as lower, is not reasonable per number sense of people's weights, and the /sandbox fix is needed, as: 62 kg. I even had to prove "reasonable" by ranges of the rounded input data, around the number 62&plusmn;0.5:
 * &rarr; 61.50 - 62.49 kg
 * In this proof of reasonable results, the rounding as "140 lb" lies outside the extremes of the rounded interval, 135.6–137.8&#160;lb, while the /sandbox fix as "137&#160;lb" is inside the rounded range. However, there were some rare cases where that proof did not always work, and so the broader validation is to round the rounded interval down+up as "135-138" and that method gave a solid sanity check for the expected results, with "137" inside and "140" as failing the check. The concept is to replace the notion that precision is set by a "mathematical formula" with precision now set by a "logical formula" which gives better results, when compared to similar numbers, such as 62 versus 62.5. And so, {Convert} is not merely a "conversion calculator" and "abbreviation clerk" but also a "precision wizard" and "measurement typesetter". -Wikid77 (talk) 06:27, 30 May 2013 (UTC)