Template:Sigfig: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
m FloraC moved page User:FloraC/Sigfig to Template:Sigfig without leaving a redirect: Ready
ArrowHead294 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{#expr:({{{1}}}) round ({{{2|3}}} - floor (ln (abs ({{{1}}}))/ln (10)) - 1)}}</includeonly><noinclude>
<includeonly>{{#invoke: Utils | round
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.
| {{{1|0}}}
 
| {{{2|3}}}
== Usage ==
}}</includeonly><noinclude>
; You type
{{documentation}}
: <code><nowiki>{{sigfig|1234.567|5}}</nowiki></code>
 
; You get
: 1234.6


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

Latest revision as of 14:59, 31 January 2025

Template documentation[view] [edit] [history] [purge]

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

You type
{{sigfig|1234.567|5}}
You get
1234.6