Template:Convert/L100km

From WikiSwire
Jump to: navigation, search

{{convert/{{{d}}}|{{{1}}}|||||||s=|r={{{r}}} |u=L/100 km |n=lit{{{r}}} per 100 kilomet{{{r}}}s |l=lit{{{r}}}s per 100 kilomet{{{r}}}s |h=lit{{{r}}}-per-100-kilomet{{{r}}}s |t=Litres per 100 kilometres |y=L{{{r}}}ck |i=i |o=mpgimp mpgus |b=(3.7854117840*62.137119224)*10000/1.445939840667 |j=6-0}}

Testcases of L100km vs L/100 km
L100km (this subtemplate) L/100km (the standard subtemplate)
0.78 L/100 km (3.6 mpg-imp; 3.0 mpg-US) 0.78 L/100 km (360 mpg-imp; 300 mpg-US)
1 L/100 km (4.6 mpg-imp; 3.8 mpg-US) 1 L/100 km (280 mpg-imp; 240 mpg-US)
3 L/100 km (14 mpg-imp; 11 mpg-US) 3 L/100 km (94 mpg-imp; 78 mpg-US)
7.8 L/100 km (36 mpg-imp; 30 mpg-US) 7.8 L/100 km (36 mpg-imp; 30 mpg-US)
10 L/100 km (46 mpg-imp; 38 mpg-US) 10 L/100 km (28 mpg-imp; 24 mpg-US)
30 L/100 km (140 mpg-imp; 110 mpg-US) 30 L/100 km (9.4 mpg-imp; 7.8 mpg-US)
78 L/100 km (360 mpg-imp; 300 mpg-US) 78 L/100 km (3.6 mpg-imp; 3.0 mpg-US)
100 L/100 km (460 mpg-imp; 380 mpg-US) 100 L/100 km (2.8 mpg-imp; 2.4 mpg-US)
Expression error: Unexpected < operator.|(Expression error: Unexpected < operator.)|Expression error: Unexpected < operator. }} L/100 km) 0.0000521 mpg-imp (5,420,000 L/100 km)
0.000521 mpg-imp (5,422.931397 L/100 km) 0.000521 mpg-imp (542,000 L/100 km)
0.00521 mpg-imp (54,229.31397 L/100 km) 0.00521 mpg-imp (54,200 L/100 km)
0.0521 mpg-imp (542,293.1397 L/100 km) 0.0521 mpg-imp (5,420 L/100 km)
0.521 mpg-imp (5,422,931.397 L/100 km) 0.521 mpg-imp (542 L/100 km)
1 mpg-imp (10,408,697 L/100 km) 1 mpg-imp (280 L/100 km)
3 mpg-imp (31,226,092 L/100 km) 3 mpg-imp (94 L/100 km)
5.21 mpg-imp (54,229,313.97 L/100 km) 5.21 mpg-imp (54.2 L/100 km)
10 mpg-imp (104,086,970 L/100 km) 10 mpg-imp (28 L/100 km)
30 mpg-imp (312,260,920 L/100 km) 30 mpg-imp (9.4 L/100 km)
52.1 mpg-imp (542,293,139.7 L/100 km) 52.1 mpg-imp (5.42 L/100 km)
100 mpg-imp (1.0408697×109 L/100 km) 100 mpg-imp (2.8 L/100 km)
521 mpg-imp (5.422931397×109 L/100 km) 521 mpg-imp (0.542 L/100 km)
Expression error: Unexpected < operator.|(Expression error: Unexpected < operator.)|Expression error: Unexpected < operator. }} L/100 km) 0.00004338 mpg-US (5,422,000 L/100 km)
Expression error: Unexpected < operator.|(Expression error: Unexpected < operator.)|Expression error: Unexpected < operator. }} L/100 km) 0.0004338 mpg-US (542,200 L/100 km)
0.004338 mpg-US (54,226.407624 L/100 km) 0.004338 mpg-US (54,220 L/100 km)
0.04338 mpg-US (542,264.07624 L/100 km) 0.04338 mpg-US (5,422 L/100 km)
0.4338 mpg-US (5,422,640.7624 L/100 km) 0.4338 mpg-US (542.2 L/100 km)
1 mpg-US (12,500,324 L/100 km) 1 mpg-US (240 L/100 km)
3 mpg-US (37,500,973 L/100 km) 3 mpg-US (78 L/100 km)
4.338 mpg-US (54,226,407.624 L/100 km) 4.338 mpg-US (54.22 L/100 km)
10 mpg-US (125,003,240 L/100 km) 10 mpg-US (24 L/100 km)
30 mpg-US (375,009,730 L/100 km) 30 mpg-US (7.8 L/100 km)
43.38 mpg-US (542,264,076.24 L/100 km) 43.38 mpg-US (5.422 L/100 km)
100 mpg-US (1.2500324×109 L/100 km) 100 mpg-US (2.4 L/100 km)
433.8 mpg-US (5.4226407624×109 L/100 km) 433.8 mpg-US (0.5422 L/100 km)


Note how, according to this subtemplate, miles per gallon (whether imperial or US) are proportional to litres per hundred kilometres. This, of course, is not true. The standard subtemplate gives the correct conversion (rounded either two sig figs or to the same number as the input, whichever is greater). Thus it converts 7.8 L/100 km correctly to 36 mpg-imp or 30 mpg-US (this was the number chosen to work with) but fails for any number much greater or less. Similarly the conversions from 0.00521 mpg-imp or 0.004338 mpg-US to L/100 km are about right but choose much different numbers and it doesn't work.

The problem is that there is no inversion being carried out. Convert II (the Oct 2007 - present version) needs the {{{d}}}F and the i=i for these volume (of fuel) per distance to work. i=i says invert but only works with F display subtemplates.

Hence this template will be taken out of service. I'm moving it into the L/100 km sandbox for testing as a subtemplate to function with Convert III (a new version currently under construction).