Template:Significant figures

From Nordic Larp Wiki
Revision as of 01:42, 29 December 2018 by Johannes Axner (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

0

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

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 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

Two parameters

  • {{significant figures|123.456|7}} gives 123.4560 [1]
  • {{significant figures|123.456|6}} gives 123.456 [2]
  • {{significant figures|123.456|5}} gives 123.46 [3]
  • {{significant figures|123.456|4}} gives 123.5 [4]

  • {{significant figures|123,456|3}} gives 123,000 [5]
  • {{significant figures|12345.6|3}} gives 12,300 [6]
  • {{significant figures|1234.56|3}} gives 1,230 [7]
  • {{significant figures|12.3456|3}} gives 12.3 [8]
  • {{significant figures|1.23456|3}} gives 1.23 [9]

  • {{significant figures|.123456|3}} gives 0.123 [10]
  • {{significant figures|.0123456|3}} gives 0.0123 [11]
  • {{significant figures|.00123456|3}} gives 0.00123 [12]
  • {{significant figures|0.123456|3}} gives 0.123 [13]
  • {{significant figures|0.0123456|3}} gives 0.0123 [14]
  • {{significant figures|0.00123456|3}} gives 0.00123 [15]

  • {{significant figures|123.456|2}} gives 120 [16]
  • {{significant figures|123.456|1}} gives 100 [17]
  • {{significant figures|123.456|0}} gives 0 [18]

  • {{significant figures|987654321|9}} gives 987,654,321 [19]
  • {{significant figures|987654321|8}} gives 987,654,320 [20]
  • {{significant figures|987654321|7}} gives 987,654,300 [21]
  • {{significant figures|987654321|6}} gives 987,654,000 [22]
  • {{significant figures|987654321|5}} gives 987,650,000 [23]
  • {{significant figures|987654321|4}} gives 987,700,000 [24]
  • {{significant figures|987654321|3}} gives 988,000,000 [25]
  • {{significant figures|987654321|2}} gives 990,000,000 [26]
  • {{significant figures|987654321|1}} gives 1,000,000,000 [27]

One parameter

  • {{significant figures|123400}} → 4 [28]
  • {{significant figures|12340}} → 4 [29]
  • {{significant figures|1234}} → 4 [30]
  • {{significant figures|123.4}} → 4 [31]
  • {{significant figures|12.34}} → 4 [32]
  • {{significant figures|1.234}} → 4 [33]

  • {{significant figures|0.1234}} → 4 [34]
  • {{significant figures|0.01234}} → 4 [35]
  • {{significant figures|0.001234}} → 4 [36]
  • {{significant figures|.1234}} → 4 [37]
  • {{significant figures|.01234}} → 4 [38]
  • {{significant figures|.001234}} → 4 [39]

  • {{significant figures|-123.4}} → 4 [40]
  • {{significant figures|-12.34}} → 4 [41]
  • {{significant figures|-1.234}} → 4 [42]