Template talk:Bbl to t

Unsatisfactory results
I found the template display unsatisfactory for 126493936 barrels
 * 126,493,936 barrels (~ Expression error: Unexpected < operatorExpression error )

While it looked okay the first and third time I previewed it here, the second time the preview looked like it did on the page where it was used it displayed as
 * 126,493,936 barrels (~2.16E+7 t)

Let's see what happens when I save it. Don't know if anything can be done about that. Gene Nygaard 15:49, 16 October 2007 (UTC)
 * I've introduced rnd to fix this problem (it still won't work if you plug in astronomically large numbers). I've also made some other changes.  Gene, there was another problem with the code you had entered.  That final pipe in 126493936 barrels was setting API to zero (with the old version).  With the old version API could be entered as the second unnamed parameter.  You were entering a blank, a zero.  This explains the ~17,300,000 t as opposed to ~21,600,000 t.  The current version uses the second unnamed parameter for precision; there is no   parameter any more (I commented this out in the above). Jɪmp 09:18, 6 March 2008 (UTC)
 * The template is in the middle of another reworking. No longer can you specify precision.  The second (fourth in the case of ranges) unnamed parameter now give the number of significant figures.
 * e.g. gives "126493936 barrels".
 * J Ѧ ρ 02:03, 7 April 2008 (UTC)

National varieties of English
It also imposes spelling that might violate Manual of Style in "full notation" by imposing a spelling of "tonnes" rather than "metric tons". (And it probably doesn't account for numbers which should be expressed in singular form in full notation, either, does it). Gene Nygaard 15:56, 16 October 2007 (UTC)
 * Well, I was not trying to "impose" anything when creating this template. The reason why the template supports neither national varieties nor singular/plural forms is because it was created as a barebones example to polish its principal function (which is, of course, the actual conversion).  The two features you mentioned are first in line to be added once I find time to continue working on the conversion templates.  On that note, if you or anyone else beat me to improving this template, I'd be more than happy to scratch this particular task off my to-do list :)—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 17:45, 17 October 2007 (UTC)


 * I think I'm beating you to it. I've got a solution. I'll be implimenting it when I've got the time. Jɪmp 09:18, 6 March 2008 (UTC)
 * What I had in mind was
 * making it such that  would control the barrel display only and
 * introducing a new parameter to control the tonne display.
 * The default would be to use the abbreviation "t" but if you should want "tonnes" or "metric tons", you'd type that in explicitely. You could even use "thousand kilograms" or "megagrams" if you like.  This input would be checked against a synonym list (in the form of a switch) to weed out nonsense.
 * I've done part 1 but I'm having second thoughts about 2. Is there much worth in allowing users to violate the manual of style via this template?  If an editor really must have the unit spelt out, can we not let them type it out by hand?  I began to wonder in which context spelling "tonne", "metric ton", etc. out would be desireable.  None sprang to mind.  None of the current transculsions spelt it out.
 * If needed part 2 can be done later. There are more useful features to add to this template.
 * Jɪmp 15:32, 6 March 2008 (UTC)
 * Thanks, Jimp. Much appreciate your help, as usual.—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 16:48, 6 March 2008 (UTC)
 * No worries. Jɪmp 17:17, 6 March 2008 (UTC)

New features
I've added/changed the following features:
 * support for adjective form:  will make barrel singular & insert hyphens.
 * input-sensitive default rounding: if the rounding factor is not specified the template now defaults to a rounding scheme based on the number of significant figures in the input. Specifically, the number of significant figures in the first unnamed parameter is calculated and compared the number of significant figures in 131.5 + API, then the minimum of these two is compared to 2, maximum of those two numbers is taken, the conversion is rounded to that many significant figures. Jɪmp 18:55, 6 March 2008 (UTC)
 * support for (production) rates: the new parameter  can be used to produce a rate as opposed to a straight quantity.  The abbreviations "h", "d" and "a" are spelt out as "hour", "day" and "annum".  With   annum links to Annum (day and hour do not currently link since these are such every-day words ... though abbreviations always link). Jɪmp 00:37, 7 March 2008 (UTC)  To use a different time unit for tonnes, use   J Ѧ ρ 04:17, 7 April 2008 (UTC)
 * support for ranges dual conversions: setting the second unnamed parameter to to will put the template into range mode. The first unnamed parameter will be the lower end & the third the upper.  Precision is moved to the fourth unnamed parameter. Jɪmp 01:36, 7 March 2008 (UTC) set the second parameter to any word, parameters 1 and 3 give the 1st and 2nd values, parameter 2 gives the conjunction, parameter 4 (if specified) gives the number of sig figs J Ѧ ρ 04:16, 7 April 2008 (UTC)
 * sig figs not precision: the second/fourth parameter no longer gives precision but number of significant figures. J Ѧ ρ 01:54, 7 April 2008 (UTC)
 * large numbers: you can add thousand, ... trillion by setting  to the appropriate SI prefix.  The conversion to tonnes is given in scientific notation for 100,000 and above. J Ѧ ρ 04:12, 7 April 2008 (UTC)

More examples



 * ranges rounded to three significant figures
 * gives||100 barrels
 * rate ranges
 * gives||100 barrels
 * range adjectives
 * gives||100 barrels
 * rate adjectives
 * gives||100 barrels
 * rate range adjectives
 * gives||100 barrels
 * linked ranges
 * gives||100 barrels
 * linked rates
 * gives||100 barrels
 * linked rate ranges
 * gives||100 barrels
 * linked abbreviated rate ranges
 * gives||100 barrels
 * linked abbreviated rate ranges rounded to three significant figures
 * gives||100 barrels
 * linked abbreviated rate ranges with specified density
 * gives||100 barrels
 * linked adjectives
 * gives||100 barrels
 * linked adjectives with specified density
 * gives||100 barrels
 * linked range adjectives
 * gives||100 barrels
 * linked rate adjectives
 * gives||100 barrels
 * rate range adjectives
 * gives||100 barrels
 * linked rate range adjectives
 * gives||100 barrels
 * colspan=3|linked abbreviated rate ranges with specified density rounded to three significant figures
 * colspan=3|
 * gives||100 barrels
 * }
 * gives||100 barrels
 * linked abbreviated rate ranges with specified density
 * gives||100 barrels
 * linked adjectives
 * gives||100 barrels
 * linked adjectives with specified density
 * gives||100 barrels
 * linked range adjectives
 * gives||100 barrels
 * linked rate adjectives
 * gives||100 barrels
 * rate range adjectives
 * gives||100 barrels
 * linked rate range adjectives
 * gives||100 barrels
 * colspan=3|linked abbreviated rate ranges with specified density rounded to three significant figures
 * colspan=3|
 * gives||100 barrels
 * }
 * linked rate adjectives
 * gives||100 barrels
 * rate range adjectives
 * gives||100 barrels
 * linked rate range adjectives
 * gives||100 barrels
 * colspan=3|linked abbreviated rate ranges with specified density rounded to three significant figures
 * colspan=3|
 * gives||100 barrels
 * }
 * gives||100 barrels
 * colspan=3|linked abbreviated rate ranges with specified density rounded to three significant figures
 * colspan=3|
 * gives||100 barrels
 * }
 * gives||100 barrels
 * }
 * }

Enhancement to allow use of MMTPA
I am trying to use this template to represent the capacity of refineries in India. The output produced is difficult to read (and apparently irritating to certain people) because of the use of scientific notation for numbers larger than 100,000. Could this template be enhanced to produce an output using SI prefixes for numbers up to 100,000,000? This is important as most refineries have a capacity that exceeds 100,000 t/a. As an example:


 * 124,200 bbl/d (~6.00 Mt/a) is far more readable than 124200 barrels

This would be an enhancement along the lines outlined in the parameter to control the tonne display, as outlined in the previous section Template talk:Bbl to t.

Albeit not essential, it would be even better if one could (as previously suggested) specify the text of the unit name, so that I could get MMTPA instead of Mt/a for my example. This is because the Indian government has chosen MMTPA as their standard unit of measure. My Gussie (talk) 22:55, 10 December 2018 (UTC)


 * For the intended purpose, it would be even better to have a conversion from tonne to bbl, but I suspect that this has not been developed, yet. My Gussie (talk) 22:58, 10 December 2018 (UTC)

Errors
With the recent move of the Template:Rnd to Template:Round the bbl to t conversion no longer works. Please adjust. Thanks. Crook1 (talk) 16:17, 22 April 2019 (UTC)