You are not currently logged in. Are you accessing the unsecure (http) portal? Click here to switch to the secure portal. |
Template:Order of magnitude
Usage
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
{{Order of magnitude|123400}}
{{{gives}}} gives 5 [1]{{Order of magnitude|12340}}
{{{gives}}} gives 4 [2]{{Order of magnitude|1234}}
{{{gives}}} gives 3 [3]{{Order of magnitude|123.4}}
{{{gives}}} gives 2 [4]{{Order of magnitude|12.34}}
{{{gives}}} gives 1 [5]{{Order of magnitude|1.234}}
{{{gives}}} gives 0 [6]{{Order of magnitude|.1234}}
{{{gives}}} gives -1 [7]{{Order of magnitude|.01234}}
{{{gives}}} gives -2 [8]{{Order of magnitude|0}}
{{{gives}}} gives 0 [9]{{Order of magnitude}}
gives 0 [10]
Incorrect usage
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"
bn:টেমপ্লেট:Order of magnitude da:Skabelon:Ordomag ja:Template:Ordomag no:Mal:Ordomag pt:Predefinição:Ordem de magnitude sr:Шаблон:Ordomag ur:سانچہ:Order of magnitude vi:Tiêu bản:Ordomag
The above documentation is transcluded from Template:Order of magnitude/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |