Jump to content

Template:Volume/doc

From Wikipedia, the free encyclopedia

This template calculates the volume of a three-dimensional space. This is for cubic feet, cubic centimeters, etc., not for converting linear measures to things like gallons.

It only accepts numeric input, not units, and does not perform conversions.

By default, it simply outputs the calculated volume, rounded to two decimal places (if rounding can be applied). Rounding value can be changed.

It can also be told to output table cells showing all three of the dimensional measures followed by the volume.

Usage

[edit]

{{Volume|1|2|3}} produces: 6

{{Volume|1.1|22.22|333.333}} produces: 8147.33

{{Volume|1|2|3}} produces:
| 1 || 2 || 3 || 6

{{Volume|1.1|22.22|333.333}} produces:
| 1.1 || 22.22 || 333.333 || 8147.33

Parameters

[edit]
  • |1=x or first unnamed parameter – First measure (e.g. length). Must be numerals (e.g. 12) or a number in decimal format (e.g. 47.93). Do not include a unit or any other data.
  • |2=y or second unnamed parameter – Second measure (e.g. width). Same format as above.
  • |3=z or third unnamed parameter – Third measure (e.g. height/depth). Same format as above.
  • |round=n – Specify a different rounding from the default, which is 2 (rounded to two decimal places, if rounding applies). Must be a numeral.
  • |cells=yes (or any other value such as y or true – Cause the template to output an inline row of table cells in the format:
    | x || y || z || volume
    (this does not include a |- line to create the table row, only the line of cells).

This template does not currently support any units or conversion. This could be changed.

Use cases

[edit]
  • Inline: "The tank has a capacity of {{Volume}} cubic feet ({{Volume}} m<sup>3</sup>)"
    • Another option (so you needn't do any manual conversion) is to add the first part (the feet measure in the example), do a page preview and note what the calculation is (540 in this case), then feed that to {{convert}}: "... ({{convert|540|cuft|m3|2|disp=out}})"
    • The two methods above can produce mismatched approximations. The first applied your own two-decimal rounding to each ft to m conversion, then multiplied these together, producing a result of 15.34. The latter method took unrounded values that were calculated from feet to meters, multiplied them, then rounded the result, producing output of 15.29. The latter method is more accurate when starting with only one set of sourced measurements. The former method may be preferable when the source provides both sets of dimensional measures, since the editor cannot be certain in which unit the measure was more accurately performed (i.e., which was converted and approximated from which), unless the source explicitly specifies this.
  • Table: Create a table the headers of which specify what the units are, then a table row, then this template, with |cells=y, as the content of the table row (the template creates cells, it doesn't go in one). If a conversion is required, it could be provided in an additional cell, in a column for that unit, e.g. with:
    {{Volume}} || {{convert|540|cuft|m3|2|disp=number}}