Template:Order of magnitude
This template is used on 160,000+ pages. To avoid large-scale disruption and unnecessary server load, any changes to this template should first be tested in its /sandbox or /testcases subpages, or in your own user subpage. The tested changes can then be added to this page in one single edit. Please consider discussing any changes on the talk page before implementing them. |
Usage
[edit source]This template calculates the (decimal) order of magnitude of numbers within the ranges 10300 to 10−300 and −10−300 to −10300.
The acceptable input and the output produced are optimised for use in other templates.
- The hyphen (not a true minus sign) is used for negative numbers.
- No separator is used for thousands.
- The template gives 0 for 0. Although, strictly speaking, this is mathematically incorrect it has been designed this way so as to be more useful in other templates. An important example of this is that when used by {{convert}} 0 °C or 0 °F is considered to be on the same order of magnitude as ±1 °C or ±1 °F respectively.
Examples
[edit source]Template:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 5 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 4 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 3 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 2 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 1 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 0 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ -1 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ -2 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=trueTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/wTemplate:Xpd/w
→ 0 Template:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/urlTemplate:Xpd/url&removecomments=true- Template:Xpdoc
Incorrect usage
[edit source]The input must be an unformatted number, or the template will emit errors:
{{Order of magnitude|}}
→ Expression error: Unexpected = operator{{Order of magnitude|123,400}}
→ Expression error: Unrecognised punctuation character ","{{Order of magnitude|foo}}
→ Expression error: Unrecognised word "foo"
Technical points
[edit source]This template calculates the order of magnitude of a number, using the natural logarithm of the absolute value of the number, divided by the log of 10. The amount is adjusted for truncation error in the digital format, and the floor number of the results is used. The magnitude of fractions, such as 0+1/1000 (-3), will also be calculated. The code uses four expansion-depth levels.
Template data
[edit source]TemplateData for Order of magnitude
This template calculates the order of magnitude of numbers within the ranges 10^300 to 10^−300 and −10^−300 to −10^300.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Number | 1 | The number to find the order of magnitude of | Number | required |