틀:Order of magnitude
이 틀은 4,100개 이상의 문서에서 사용 중인 틀입니다. 이 틀을 수정하면 많은 문서에 영향을 줄 수 있습니다. 기여할 모든 내용은 /연습장이나 /시험장 또는 자신의 사용자 하위 문서에서 사전 점검을 거쳐야 합니다. 이 틀을 수정하기 전에, 먼저 토론 문서에 의견을 구하시는 것이 좋습니다. |
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}}
{{Order of magnitude|12340}}
{{Order of magnitude|1234}}
{{Order of magnitude|123.4}}
{{Order of magnitude|12.34}}
{{Order of magnitude|1.234}}
{{Order of magnitude|.1234}}
{{Order of magnitude|.01234}}
{{Order of magnitude|0}}
{{Order of magnitude}}
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"
Technical points
편집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
편집This template calculates the order of magnitude of numbers within the ranges 10^300 to 10^−300 and −10^−300 to −10^300.
변수 | 설명 | 형식 | 상태 | |
---|---|---|---|---|
Number | 1 | The number to find the order of magnitude of | 숫자 | 필수 |
See also
편집- {{Orders of magnitude}}
- {{Fractions}}
- {{Fractions and ratios}}