Template:Val/doc

Purpose
This template is used to easily present values in, including uncertainty and/or units. It wraps the entire result in a nowrap block, so that it never gets broken into separate pieces at the end of a line.

Arguments
There are four ways this template can be used: They all take roughly the same arguments
 * - for displaying values without uncertainty/significance.
 * - for displaying values with uncertainty like so $1,234$.
 * - for displaying values with uncertainty like so val|1234|+56|-78.
 * - for displaying values with significance like so val 1234 (56).

See val/test for a list of examples of the correct output of val and the errors it may return when incorrectly used.

Errors
There is strict checking on the validity of arguments; any incorrect use will result in an error, which is displayed using FormattingError. Pages that contain incorrect use of this template will show up on Category:Pages with incorrect formatting templates use.

Format convention
As mentioned before, val should produce formatting compliant with the wikipedia manual of style. It currently produces formatting compliant with the U.S. Government Printing Office Style Manual, in rules 12.9e and 12.14, which requires that the decimal separator be a full stop; i.e. “decimal point” (.), requires comma-delimiting to the left of the decimal point for numbers with four or more digits to the left (values of $123.24$ or more), and also requires space-delimiting to the right of the decimal point for numbers containing five or more digits to the right (e.g., $123.24$ and $123.23$ and $123.23$).

Note that if is used on numbers simultaneously comprising four or more digits to the left of the decimal point and five or more digits to the right, the resultant expression will delimited with commas left and spaces (actually non-selectable, non-breaking, narrow gaps) right (see below).

Examples



 * xpdop3c gives=|| → |||d=|val|21563.252564425
 * colspan=3|Uncertainty/significance
 * || → ||val|1.234|0.005
 * || → ||val|1.234|+0.005|-0.006
 * || → ||val|1.234|(5)
 * colspan=3|Exponents/units
 * || → ||val|1.234|e=5|u=m
 * || → ||val|1.234|e=5|u=m2
 * || → ||val|1.234|e=5|ul=m
 * || → ||val|1.234|0.056|e=7
 * || → ||val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s
 * || → ||val|1.234|0.056|e=7|ul=psi
 * || → ||val|123.4|ul=USgal
 * || → ||val|12.34|ul=mpgimp
 * colspan=3|Prefix/suffix
 * }
 * || → ||val|1.234|e=5|u=m
 * || → ||val|1.234|e=5|u=m2
 * || → ||val|1.234|e=5|ul=m
 * || → ||val|1.234|0.056|e=7
 * || → ||val|1.23456|+0.00007|-0.00008|e=-9|ul=m/s
 * || → ||val|1.234|0.056|e=7|ul=psi
 * || → ||val|123.4|ul=USgal
 * || → ||val|12.34|ul=mpgimp
 * colspan=3|Prefix/suffix
 * }
 * || → ||val|1.234|0.056|e=7|ul=psi
 * || → ||val|123.4|ul=USgal
 * || → ||val|12.34|ul=mpgimp
 * colspan=3|Prefix/suffix
 * }
 * || → ||val|12.34|ul=mpgimp
 * colspan=3|Prefix/suffix
 * }
 * }
 * }
 * }