Difference between revisions of "Template:Significant figures"

From Timelines
Jump to: navigation, search
m
(Examples)
Line 1: Line 1:
<includeonly>{{#ifeq:{{{1}}}|0|0|{{Sigfig/{{#if:{{{2|}}}|rnd|sum}}|{{{1}}}|{{{2}}}|{{Ordomag|{{{1}}}}}}}}}</includeonly><noinclude>This template has two different functions dependant on input.
+
<includeonly>{{#ifeq:{{{1}}}|0|0|{{Sigfig/{{#if:{{{2|}}}|rnd|sum}}|{{{1}}}|{{{2}}}|{{Ordomag|{{{1}}}}}}}}}</includeonly><noinclude>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 10<sup>12</sup> to 10<sup>-12</sup> and -10<sup>-12</sup> to -10<sup>12</sup>.  It ignores any digits outside of this range<!--... maybe -->.
+
#If only one parameter is given the template counts the number of [[significant figures]] of the given number within the ranges 10<sup>12</sup> to 10<sup>-12</sup> and -10<sup>-12</sup> to -10<sup>12</sup>.  It ignores any digits outside of this range<!--... maybe -->.
 
#If two parameters are given the template rounds the first number to the number of significant figures given by the second.
 
#If two parameters are given the template rounds the first number to the number of significant figures given by the second.
 +
 +
Examples:
 +
*{{xpdop3p3c|d=|sigfig|123.456|||7}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||6}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||5}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||4}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||3}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||2}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||1}}
 +
*{{xpdop3p3c|d=|sigfig|123.456|||0}}
 +
 +
*{{xpdop3c|d=|sigfig|123400}}
 +
*{{xpdop3c|d=|sigfig|12340}}
 +
*{{xpdop3c|d=|sigfig|1234}}
 +
*{{xpdop3c|d=|sigfig|123.4}}
 +
*{{xpdop3c|d=|sigfig|12.34}}
 +
*{{xpdop3c|d=|sigfig|1.234}}
 +
*{{xpdop3c|d=|sigfig|.1234}}
 +
*{{xpdop3c|d=|sigfig|.01234}}
 +
*{{xpdop3c|d=|sigfig|.001234}}
 +
  
 
[[Category:Mathematical function templates|{{PAGENAME}}]]
 
[[Category:Mathematical function templates|{{PAGENAME}}]]
 
[[pt:Predefinição:Sigfig]]
 
[[pt:Predefinição:Sigfig]]
 
</noinclude>
 
</noinclude>

Revision as of 01:32, 29 August 2010

This template has two different functions dependent on input.

  1. 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 of this range.
  2. If two parameters are given the template rounds the first number to the number of significant figures given by the second.

Examples: