Template:Sigfig: Difference between revisions

m FloraC moved page User:FloraC/Sigfig to Template:Sigfig without leaving a redirect: Ready
Use the module
Line 1: Line 1:
<includeonly>{{#expr:({{{1}}}) round ({{{2|3}}} - floor (ln (abs ({{{1}}}))/ln (10)) - 1)}}</includeonly><noinclude>
<includeonly>{{#invoke:Utils|round|{{{1|0}}}|{{{2|3}}}}}</includeonly><noinclude>
This template rounds a number to a given number of significant figures. The first argument is the number to be rounded. The second argument is the number of significant figures. If not specified the default value is 3.  
This template rounds a number to a given number of significant figures. The first argument is the number to be rounded. The second argument is the number of significant figures; if not specified the default value is 3.  


== Usage ==
== Usage ==
Line 7: Line 7:


; You get
; You get
: 1234.6
: {{{{PAGENAME}}|1234.567|5}}


[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>