Template:Val/doc

Purpose
This template is used to easily present values in scientific notation, including uncertainty and/or units, as prescribed by Wikipedia's Manual of Style. It wraps the entire result in a nowrap block, so that it never gets broken into separate pieces at the end of a line. (See WP:NBSP for more information on the usage of non-breaking spaces.)

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 $1,234$.
 * - for displaying values with significance like so $1,234$.

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 Wikipedia's 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 $e$ 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.24$ 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



 * colspan=3|Uncertainty/significance
 * colspan=3|Exponents/units
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Uncertainty/significance
 * colspan=3|Exponents/units
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Exponents/units
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Exponents/units
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Exponents/units
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * colspan=3|Prefix/suffix
 * }
 * }
 * }

Performance impact
For most uses, in the text of articles, Template:Val will not restrict performance, but when used inside the wikitext markup of large templates, there are some restrictions. When displaying integer amounts, Template:Val has an internal expansion depth of 15 levels, but for numbers with decimal portions, it uses 22 levels, or more.