Template:Val/doc: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>SkyLined
Updated examples, removed "n" examples
meta>SkyLined
Updated arguments, removed "n" argument
Line 16: Line 16:
: for displaying values with significance like so {{val/()|1234|56}}.
: for displaying values with significance like so {{val/()|1234|56}}.
They all take roughly the same arguments
They all take roughly the same arguments
:'''1''' The value (or nothing if you use the "n" argument)
:'''1''' The value
:'''2''' The (upper limit of) uncertainty or significance (required for "±", "+-" and "()")
:'''2''' The (upper limit of) uncertainty or significance (required for "±", "+-" and "()")
:'''3''' The lower limit of uncertainty (must be a negative value, required for "+-")
:'''3''' The lower limit of uncertainty (must be a negative value, required for "+-")
You can use the following optional named arguments:
:'''e''' The exponent for the power of 10 (optional).
:'''n''' The value as a number to be formatted using {{tl|delimitnum}} (Argument '''1'''must be empty when using this, eg. <code><nowiki>{{</nowiki>val||n=...|...}}</code>)
:'''u''' The units for the number (optional).
:'''e''' The exponent for the power of 10.
Values (arguments 1-3) are run through {{tl|delimitnum}} for readability. '''This may mess them up if the last few digits are on the right hand side of the decimal dot and they are zero. This is a known issue.'''<br/>
:'''u''' The units for the number.
Units are replaced by a more esthetically pleasing HTML representation and get a link, if they are in the list found in {{tl|ScientificValue/units}} or if they are supported by {{tl|convert}}. A good example is "m/s", which gets translated to "[[Meter per second|m·s<sup>-1</sup>]]".
Units are replaced by a more esthetically pleasing HTML representation and get a link, if they are in the list found in {{tl|ScientificValue/units}} or if they are supported by {{tl|convert}}. A good example is "m/s", which gets translated to "[[Meter per second|m·s<sup>-1</sup>]]".



Revision as of 20:55, 9 April 2008

Template:Template doc page viewed directly

Purpose

Set of templates that can be used to easily present values in scientific notation, including uncertainty. They have the same look and feel and wrap the entire result in a"nowrap" block, so it never gets broken in seperate pieces at the end of a line.

Arguments

There are four variations of this template:

for displaying values without uncertainty/significance.
for displaying values with uncertainty like so Template:Val/±.
for displaying values with uncertainty like so Template:Val/+-.
for displaying values with significance like so Template:Val/().

They all take roughly the same arguments

1 The value
2 The (upper limit of) uncertainty or significance (required for "±", "+-" and "()")
3 The lower limit of uncertainty (must be a negative value, required for "+-")
e The exponent for the power of 10 (optional).
u The units for the number (optional).

Values (arguments 1-3) are run through {{delimitnum}} for readability. This may mess them up if the last few digits are on the right hand side of the decimal dot and they are zero. This is a known issue.
Units are replaced by a more esthetically pleasing HTML representation and get a link, if they are in the list found in {{ScientificValue/units}} or if they are supported by {{convert}}. A good example is "m/s", which gets translated to "m·s-1".

Examples

{{val|123456789.0123456789}}  →  123456789.0123456789
Uncertainty/significance
{{val/±|1.234|0.005}}  →  Template:Val/±
{{val/+-|1.234|+0.005|-0.001}}  →  Template:Val/+-
{{val/()|1.234|5}}  →  Template:Val/()
Exponents/units
{{val|1.234|e=10|u=m}}  →  1.234×1010 m
{{val/±|1.234|0.05|e=5}}  →  Template:Val/±
{{val/+-|1.234567|+0.00005|-0.00004|e=-23|u=m/s}}  →  Template:Val/+-
{{val/±|1.234567|0.04|e=3|u=psi}}  →  Template:Val/±
{{val|123.4|u=USgal}}  →  123.4 US gal
{{val|12.34|u=mpgimp}}  →  12.34 mpg‑imp