Template:ExactlyOrAbout: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Inthar (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq: {{#expr: {{sigfig| {{{1}}} |{{{sigfigs|3}}}}} - {{{1}}}}} | 0 |exactly|about}} {{sigfig| {{{1}}} |{{{sigfigs|3}}}}}</includeonly><noinclude>
<includeonly>{{#ifeq: {{#expr: {{sigfig|{{{1}}}|{{{sigfigs|3}}}}} - {{{1}}}}}|0|exactly|about}} {{sigfig|{{{1}}}|{{{sigfigs|3}}}}}</includeonly><noinclude>
If the input value ''x'' to {{{sigfigs}}} (3 by default) [[Wikipedia: Significant figures|significant figures]] = the exact value, display "exactly ''x''"; otherwise display "about ''x''" (rounded to {{{sigfigs}}} significant figures).
{{documentation}}
 
== Usage ==
; You type
: <code><nowiki>{{ExactlyOrAbout|24}}</nowiki></code>
: <code><nowiki>{{ExactlyOrAbout|16.667}}</nowiki></code>
: <code><nowiki>{{ExactlyOrAbout|16.667|sigfigs=4}}</nowiki></code>
: <code><nowiki>{{ExactlyOrAbout|16.67|sigfigs=4}}</nowiki></code>
 
; You get
: {{{{PAGENAME}}|24}}
: {{{{PAGENAME}}|16.667}}
: {{{{PAGENAME}}|16.667|sigfigs=4}}
: {{{{PAGENAME}}|16.67|sigfigs=4}}
== See also ==
* [[Template:Sigfig]] – the template that rounds a number to a given number of significant figures


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

Latest revision as of 18:30, 30 January 2025

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

If the input value x to {{{sigfigs}}} (3 by default) significant figures = the exact value of x, display "exactly x"; otherwise display "about x" (rounded to specified significant figures).

Usage

You type You get
{{ExactlyOrAbout|24}} exactly 24
{{ExactlyOrAbout|16.667}} about 16.7
{{ExactlyOrAbout|16.667|sigfigs=4}} about 16.67
{{ExactlyOrAbout|16.67|sigfigs=4}} exactly 16.67

See also

  • Template:Sigfig – the template that rounds a number to a given number of significant figures