Template talk:Convert/Archive November 2016

Latest comment: 8 years ago by Iazyges in topic Roman mile


Faulty mathematics

This template need some adjustment. When used, it converts 36 inches to 910 mm, when the standard equivalent is 914.4 mm (eg. as the maximum circumference of a curling stone). Best of wishes.--Paracel63 (talk) 12:35, 31 October 2016 (UTC)

@Paracel63: no, this is not faulty. The template by default attempts to preserve the precision of the original. So:
  • {{convert|36|in|mm}} → 36 inches (910 mm) – 2 significant figures in the original so the same in the conversion
  • {{convert|36|in|mm|1}} → 36 inches (914.4 mm) – force 1 decimal place
When suspecting such an obvious blunder, may I suggest first reading the documentation? Peter coxhead (talk) 13:19, 31 October 2016 (UTC)
Interestingly:
  • {{convert|36|in|mm}} -> 36 inches (910 mm)
  • {{convert|36.0|in|mm}} -> 36.0 inches (910 mm)
  • {{convert|36.00|in|mm}} -> 36.00 inches (914 mm)
  • {{convert|35.998|in|mm}} -> 35.998 inches (914.3 mm)
  • {{convert|36.000|in|mm}} -> 36.000 inches (914.4 mm)
  • {{convert|36.002|in|mm}} -> 36.002 inches (914.5 mm)
If you want precision out, it helps to have precision in :) --RexxS (talk) 18:50, 31 October 2016 (UTC)
Interesting indeed. I thought 36 inches would mean exactly 36 inches. Now I understand this would be an erroneous assumption (as 36 inches doesn't make a yard, according to this template)…   That would also explain the results in the curling article (where this template is used a lot). I had to check the official regulation at www.worldcurling.org, just to clarify what their 36 inches would be equivalent with. Best of wishes.--Paracel63 (talk) 23:31, 31 October 2016 (UTC)
If you think about it, "36 inches" could represent anywhere from 35.5 inches to 36.5 inches, given normal rounding; whereas "1 yard" could represent somewhere between 0.5 and 1.5 yards by the same convention. So "36 inches" really isn't the same as "1 yard"! Cheers --RexxS (talk) 23:54, 31 October 2016 (UTC)
Which is why I nearly always specify the precision required:
  • {{convert|36|in|mm}} -> 36 inches (910 mm)
  • {{convert|36|in|mm|-1}} -> 36 inches (910 mm)
  • {{convert|36|in|mm|0}} -> 36 inches (914 mm)
  • {{convert|36|in|mm|1}} -> 36 inches (914.4 mm)
  • {{convert|36|in|mm|2}} -> 36 inches (914.40 mm)
  • {{convert|36|in|mm|rnd=5}} -> 36 inches (910 mm)* - rounded to 5mm  Stepho  talk  05:38, 1 November 2016 (UTC)
Paracel63, if you'll look at my edit to the Curling article, you'll see how I made the Convert template do exactly as I wanted. For me at least, a key to successful implementation is to use the most precise measurement available as the input, then specify the precision of the output. Huntster (t @ c) 06:37, 1 November 2016 (UTC)
Many thanks for the clarification and help with the curling measurements. While googling, I noticed a lot of websites that mentioned 910 mm (and very few mentioning 914.4 mm) as the maximum circumference of the curling stone. This could be a sign of the influence of Wikipedia.  --Paracel63 (talk) 13:59, 1 November 2016 (UTC)
I don't want to spoil the game, but... The "36 inch" is not a measurement (with a level of precision), but a definition, defined in the Rules of the Game. As such no precision-zero's should be added: that interpretation is an addition to the rules! Now the problem for the Ruling Body of the game is: how to measure it? When should a curling stone be rejected for a game? Because even with a sophisticated tape measure, the measured length has an unknown imprecision. And that is within the inches world. I think best is not to enter the precision topic in a definition (and calculate the metric length as correct as possible: 36 inch = 914.4 mm. Then the Ruling Body of the game should prescribe, separately, how to handle imprecision. -DePiep (talk) 08:34, 2 November 2016 (UTC)
Are we looking at the same source? The one I read gave both US and metric values, the same ones we now have in the article. Kendall-K1 (talk) 13:59, 2 November 2016 (UTC)
(edit conflict) DePiep, I apologize, but I really don't understand what you are trying to get at here. As it stands, the article reflects exactly what the source provides: {{convert|914.4|mm|in|0|order=flip}} → 36 inches (914.4 mm), flipped to provide inches first as that's what is used in the article. They say 36 inches, so we say 36 inches. Huntster (t @ c) 14:06, 2 November 2016 (UTC)
I did not read the articles nor the source links. I respond to the OP rounding question here. My point is: '36 in' is a definition by the Ruling Board. And after that we/wp should not and can not make any assumption of the precision allowed. The Curling Ruling Board must say how that definition is to be measured & judged, before allowing a curling stone into a match.
Compare {{Track gauge}}: defined track gauges (the railroad company says: we want track gauge "5 ft" -- a definition, not a measurement). -DePiep (talk) 20:32, 2 November 2016 (UTC)
The original question was how to get the conversion to display a particular value to match what's in the source. If you have a source that contradicts the one cited at the article, then that would be a subject for discussion at the article talk page. Kendall-K1 (talk) 22:04, 2 November 2016 (UTC)
I also found some interesting unit conversion here: 100 kW (140 PS) — this is not correct. I used {{convert|100|kW|PS|abbr=on}}
However, 100 kW equals 136 DIN-PS. To make the template convert correctly, the precision has to be set to "0". I would recommend that the precision will be set to "0" in this template by default to avoid incorrect conversions. --Jojhnjoy (talk) 13:52, 7 November 2016 (UTC)
@Jojhnjoy: I think the issue is that 100 kW, without qualification, implies a precision only to the nearest hundred. This could be any exact value from 50 kW to 149 kW when rounded. The template then outputs its results based on that level of precision, giving the 136 DIN-PS. Now, if the value is actually known to the nearest single unit, then we'd narrow that range to 99.5–100.4 and an output value to the nearest unit would be appropriate. You can test that by looking at {{convert|101|kW|PS|abbr=on}} or 101 kW (137 PS), which has an input value that implies precision to the nearest unit. Imzadi 1979  14:11, 7 November 2016 (UTC)
We need to be cautious in suggesting that using |0 specifies a precision - it actually specifies 'zero decimal places'. If we want to ensure the output has zero decimal places, then it's the right parameter, but sometimes we actually want to simply ensure that a certain level of accuracy is output, when |sigfig= is the correct way. Compare:
No precision:
  • 100 kW (140 PS)
  • 10 kW (14 PS)
  • 1 kW (1.4 PS)
  • 100.0001 kW (135.9623 PS)
Zero decimal places ('|0'):
  • 100 kW (136 PS)
  • 10 kW (14 PS)
  • 1 kW (1 PS)
3 sig fig ('|sigfig=3'):
  • 100 kW (136 PS)
  • 10 kW (13.6 PS)
  • 1 kW (1.36 PS)
Without knowing the precision of the input value, there's no way of deciding what is best, but if we know that a value is accurate to around 1%–10%, then setting 2 significant figures is optimal; similarly 3 sig fig represents 0.1%–1% accuracy. --RexxS (talk) 15:20, 7 November 2016 (UTC)
Bright refinement. Am I right in saying this: "the first example, 'No precision e.g. 100 kW (140 PS)', uses a {{Convert}}-internal default. (There is no universal recipe for 'no precision', as there is for 'zero decimal places' and 'number of sigfig'). ?
Apart from this, maybe the section #Rounding in the template documentation should be rewritten from scratch. These questions pop up too often on this talkpage, indicating something is wrong in the /doc. It's a large chunk, too big for ease of first reading IMO. (Disclosure: when I rewrote the /doc after {{Convert}} went Lua years ago, I sort of skipped this section). -DePiep (talk) 10:55, 9 November 2016 (UTC)

Rounding to multiples of 5 (or 25) and fractions of 5 (or 25)

eg using {{convert|7|to|8|ft|m|1|round=5}} (or similar) I would like the output to be 7 to 8 feet (2 - 2.5 m) not 7 to 8 feet (2.1 to 2.4 m)

and

{{convert|3.5|mi|km|sigfig=2|round=5}} to be 3.5 miles (5.5 km) not 3.5 miles (5.6 km)

Help pls Cinderella157 (talk) 07:49, 9 November 2016 (UTC)

@Cinderella157: The first issue has an easy solution, use to(-). The second is a bit more involved. There is a conflict between sigfig=2 (output has 2 significant figures) and round=5 (output rounded to the nearest multiple of 5). The first convert is also invalid because 1 means the output is rounded to 1 decimal place, and that conflicts with round=5. Convert will use one of the rounding alternatives provided and will ignore the other.
Try these:
  • {{convert|7|to(-)|8|ft|m|round=5}} → 7 to 8 feet (0–0 m) (see below)
  • {{convert|7|to(-)|8|ft|m|round=0.5}} → 7 to 8 feet (2–2.5 m)
  • {{convert|3.5|mi|km|round=0.5}} → 3.5 miles (5.5 km)
The first convert gives zero as the output because 7 feet is 2.13 m, and 8 feet is 2.44 m. Those values round to zero with round=5. Johnuniq (talk) 09:58, 9 November 2016 (UTC)

@Johnuniq many thanks Cinderella157 (talk) 07:10, 10 November 2016 (UTC)

Roman mile

Could someone please add Roman miles to the length? A roman mile is equal to about 4851 feet. Thanks. Iazyges Consermonor Opus meum 05:55, 17 November 2016 (UTC)

@Iazyges: Are you sure that would be helpful? As expected, Ancient Roman units of measurement and Mile#Roman mile have only vague statements about what a Roman mile is, with varying rules. I have found sizes.com to have good information, and it says "Somewhere between 1471 and 1485 meters", and also "a well-accepted guess at the length of the mille passus in Roman Britain is about 1,479.5 meters [4,854.0 ft]". If an historical document specifies dimensions in Roman miles, it may be misleading to convert the values as if a precise conversion factor were known. What articles would benefit from an automated conversion? Johnuniq (talk) 06:53, 17 November 2016 (UTC)
@@Johnuniq: Roman ones in general, largely milhist, as the distances for marches, and the distances in treaties are well recorded, along with ancient geography. I would probably go with the 4854 feet as a roman mile. Iazyges Consermonor Opus meum 07:12, 17 November 2016 (UTC)
I guess that what is probably needed is a one-way conversion that yields something like 100 Roman miles (about 92 mi; 148 km). I can see that historical accounts would benefit from having a conversion that allowed readers to conveniently visualise such distances. Nevertheless, as Johnuniq says, we shouldn't be implying a precision that is greater than the uncertainty in the conversion factor (around 1%), so the use of such a conversion would have to be carefully done, otherwise I foresee nonsense like 105 Roman miles (96.53 mi) - or even (509,670 ft). --RexxS (talk) 18:18, 17 November 2016 (UTC)
It would be cool if the template knew the uncertainty in the conversion. It could then insert the "about" modifier, and refuse to accept a sigfig= (or an implied sigfig) greater than the uncertainty. I was thinking about this recently in connection with Ton of refrigeration, which has no exact conversion to SI units. I'm quite certin Johnuniq will eagerly rush to implement this. Kendall-K1 (talk) 18:43, 17 November 2016 (UTC)
Forgive my lack of experience with templates like these (most of my work is in a usercheck I have made, and some others), how would the "about" code be implemented, would it be a range such as 1 roman mile (1471-1485 metres) or would it be 1 roman mile (c. 1481 metres)? Iazyges Consermonor Opus meum 21:55, 17 November 2016 (UTC)
(not an answer...). You are forgiven right away! The topic of rounding, precision, about, significant digits, nearest 5, /doc#Rounding, etc.: this is the most complicated topic of this template {{convert}}. To get a taste, just see section #Faulty_mathematics above. So many issues are involved. For starters: how exact was the original measurement? How to round (how many digits after decimal sign) when converted say meter into ft? Welcome to this. -DePiep (talk) 22:10, 17 November 2016 (UTC)
One problem is that until the time of agrippa, one mile was defined as 1000 legions paces, so if the legion was tired a mile could be 2 thousand feet, if they werent it could be almost double that. We do know that it was exactly 5000 roman feet, and the roman foot is 97% of a normal foot, so I propose setting it as "About 4850 feet". Iazyges Consermonor Opus meum 22:17, 17 November 2016 (UTC)
I should probably have attached a smiley to my comment (although many people don't know what that means any more). The pitfalls are so numerous that I doubt we could agree on how the "about" feature would work, much less how to implement it. Kendall-K1 (talk) 22:24, 17 November 2016 (UTC)

I added the unit romi as an experiment. When convert is next updated (probably months from now) I will have a look at how the unit is used. If it appears to be useful (and subject to discussion here), we can keep it. Otherwise, the unit can be removed. I used the 1,479.5 meters [4,854.0 feet] "well-accepted guess at the length of the mille passus in Roman Britain" from sizes.com as above. I suspect romi will not be particularly useful as described above, but we can see. Examples:

The last example shows that there is no symbol for the new unit. I picked km mi for the default output because that is what other units like admi (admirality mile), AU (astronomical unit), and nmi (nautical mile) do. Johnuniq (talk) 00:37, 18 November 2016 (UTC)

Thanks! Iazyges Consermonor Opus meum 00:48, 18 November 2016 (UTC)