[go: up one dir, main page]

Aller au contenu

Modèle:Val

Une page de Wikipédia, l'encyclopédie libre.

 Documentation[voir] [modifier] [historique] [purger]

This template is used to easily present values in scientific notation, including uncertainty and/or units, as prescribed by Wikipedia's Manual of Style.

Utilisation

[modifier le code]

Val specializes in numeric values, especially those with scientific notations, uncertainty notations, and those with measurement values with physical units. Because these expressions are covered by the Manual of Style, Val provides the stylized output for you, and keeps them from wrapping across lines.

Express a numeral:

  • {{val|123456.78901}}value, formated with gaps: 123 456,789 01, or with |fmt=commas → 1 234,567 890 1.
  • {{val|number|number}}value ± uncertainty, like 123 478 ± 56
  • {{val|number|number|number}}value (su) like 1 234+56
    −78

Express a measurement value: {{val|4|u=m2}} → 4 m2. The m2 is a "unit code" that Val uses to lookup the link to the unit's article, and the formatting of the unit symbol.

Sometimes a number and unit code is not enough. A prefix or suffix are also available, |p= and |s=.

  • {{val|7600|u=C&sdot;Ga|p=>|s=<}} → >7 600 C⋅Ga<
  • {{val|7600|u=C|p=<span style="color:green"><sup>|s=</sup></span>}}7 600 C

Arguments

[modifier le code]

Val takes three unnamed parameters. The first is always the numeric value. When the second and third are numbers they become the various uncertainty notations, but the second unnamed parameter can also serve to grammatically join the first and third numbers.

Val clears surrounding spaces in its unnamed parameters.

'1 st' A number in decimal point notation or in e notation. The main basis of the Val expression. Defaults to 10 0.

{{val| 1234567.1234567 }} → 1 234 567,123 456 7
{{val|.1234}} → 0,123 4                     (adds the zero)
{{val|+1234}} → +1 234                     (passes the plus)
{{val|-1234}} → −1 234                     (replaces dash with minus)
{{val|1234}} → 1 234                         (four-digits pure)
{{val|12e34}} → 12 × 1034                (E notation)

'2 nd'
Uncertainty in either format.

{{val|11|22}} → 11 ± 22
{{Val|11|(22)}} → 11 ± (22)

'3 rd' Asymmetric uncertainty.

{{Val|11|22|33}} → 11+22
−33

|u= Val adds a space and the unit.

|u= Don't link the unit. Also accepts wiki markup in lieu of a unit code.

|p= Prefix the entire Val expression. Non-spaced, but accepts markup.

{{Val|11|22|ul=m/s|p=<Prefix>}} → <Prefix>11 ± 22
{{Val|11|22|ul=m/s|p=<Prefix>&nbsp;}} → <Prefix> 11 ± 22

|s= Suffix the entire Val expression. Non-spaced, but accepts markup.

{{Val|11|22|ul=m/s|s=<Suffix>}} → 11 ± 22<Suffix>
{{Val|11|22|ul=m/s|s=&nbsp;<Suffix>}} → 11 ± 22 <Suffix>

|e= Exponential. Val also accepts e notation.

{{Val|11|22|33|e=11}} → 11+22
−33
 × 1011
{{Val|11e11|22|33}} → 11+22
−33
 × 1011

More example expressions

[modifier le code]
Number

{{val|1234567.1234567}} → 1 234 567,123 456 7
.{{val|  1234567.1234567   }}..1 234 567,123 456 7.
{{val|-1234567}} → −1 234 567

Uncertainty

{{val|1.234|0.005}} → 1,234 ± 0,005
{{val|1.234|+0.005|-0.006}} → 1,234+0,005
−0,006

{{val|1.234|(5)}} → 1,234 ± (5)

Units

{{val|1.234|u=m}} → 1,234 m
{{val|1.234|u=m2}} → 1,234 m2

{{val|12.34|u=deg}}12,34 deg
{{val|1.234|0.005|u='}} → 1,234 ± 0,005 '
{{val|1.234|+0.005|-0.006|u="}} → 1,234+0,005
−0,006
 "

{{val|1.234|u=%}} → 1,234 %

Exponents

{{val|1.234e7|0.056}} → (1,234 ± 0,056) × 107
{{val|1.234|0.056|e=7}} → (1,234 ± 0,056) × 107

{{val|1.234e-2|(5)}} → (1,234 ± (5)) × 10−2
{{val|1.234|(5)|e=-2}} → (1,234 ± (5)) × 10−2

Prefix/suffix

{{val|12.34|p=Δ&nbsp;}} → Δ 12,34
{{val|12.34|u=%|p=≅}} → ≅12,34 %
{{val|12.34|0.25|s=%}} → 12,34 ± 0,25%