Template:Significant figures/doc
Jump to navigation
Jump to search
This is a documentation subpage for Template:Significant figures. It contains usage information, categories and other content that is not part of the original template page. |
This template has two different functions dependent on input.
- If only one parameter is given the template counts the number of significant figures of the given number within the ranges 1012 to 10−12 and −10−12 to −1012. It ignores any digits outside this range.
- If two parameters are given the template rounds the first number to the number of significant figures given by the second.
Examples
Two parameters
{{significant figures|123.456|7}}
→ 123.4560{{significant figures|123.456|6}}
→ 123.456{{significant figures|123.456|5}}
→ 123.46{{significant figures|123.456|4}}
→ 123.5
{{significant figures|123,456|3}}
→ 123,000{{significant figures|12345.6|3}}
→ 12,300{{significant figures|1234.56|3}}
→ 1,230{{significant figures|12.3456|3}}
→ 12.3{{significant figures|1.23456|3}}
→ 1.23
{{significant figures|.123456|3}}
→ 0.123{{significant figures|.0123456|3}}
→ 0.0123{{significant figures|.00123456|3}}
→ 0.00123{{significant figures|0.123456|3}}
→ 0.123{{significant figures|0.0123456|3}}
→ 0.0123{{significant figures|0.00123456|3}}
→ 0.00123
{{significant figures|123.456|2}}
→ 120{{significant figures|123.456|1}}
→ 100{{significant figures|123.456|0}}
→ 0
{{significant figures|987654321|9}}
→ 987,654,321{{significant figures|987654321|8}}
→ 987,654,320{{significant figures|987654321|7}}
→ 987,654,300{{significant figures|987654321|6}}
→ 987,654,000{{significant figures|987654321|5}}
→ 987,650,000{{significant figures|987654321|4}}
→ 987,700,000{{significant figures|987654321|3}}
→ 988,000,000{{significant figures|987654321|2}}
→ 990,000,000{{significant figures|987654321|1}}
→ 1,000,000,000
One parameter
{{significant figures|123400}}
→ 4{{significant figures|12340}}
→ 4{{significant figures|1234}}
→ 4{{significant figures|123.4}}
→ 4{{significant figures|12.34}}
→ 4{{significant figures|1.234}}
→ 4
{{significant figures|0.1234}}
→ 4{{significant figures|0.01234}}
→ 4{{significant figures|0.001234}}
→ 4{{significant figures|.1234}}
→ 4{{significant figures|.01234}}
→ 4{{significant figures|.001234}}
→ 4
{{significant figures|-123.4}}
→ 4{{significant figures|-12.34}}
→ 4{{significant figures|-1.234}}
→ 4
Supporting templates and modules
- {{Significant figures/rnd}}, which uses {{Rnd}}, which uses {{#invoke:Math|precision_format}}
- {{Significant figures/sum}}, which uses {{Precision}}, which uses {{#invoke:Math|precision}}
- {{Order of magnitude}}