Template:ExactlyOrAbout: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
+examples
Inthar (talk | contribs)
Added a sigfigs parameter.
Line 1: Line 1:
<includeonly>{{#ifeq: {{#expr: {{sigfig| {{{1}}} }} - {{{1}}} }} | 0 |exactly|about}} {{sigfig| {{{1}}} }}</includeonly><noinclude>
<includeonly>{{#ifeq: {{#expr: {{sigfig| {{{1}}} }} - {{{1}}} |{{{sigfigs|3}}}}} | 0 |exactly|about}} {{sigfig| {{{1}}} }}</includeonly><noinclude>
If the input value ''x'' to 3 [[Wikipedia: Significant figures|significant figures]] = the exact value, display "exactly ''x''"; otherwise display "about ''x''".  
If the input value ''x'' to {{{sigfigs}}} significant figures (3 by default) [[Wikipedia: Significant figures|significant figures]] = the exact value, display "exactly ''x''"; otherwise display "about ''x''".  


== Usage ==
== Usage ==

Revision as of 22:48, 21 May 2023

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

Usage

You type
{{ExactlyOrAbout|24}}
{{ExactlyOrAbout|16.667}}
You get
exactly 24
about 16.7

See also

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