Significant Figures Calculator Formula

Understand the math behind the significant figures calculator. Each variable explained with a worked example.

Formulas Used

Rounded

rounded = num != 0 ? round(num / pow(10, floor(log10(abs(num))) - sig_figs + 1)) * pow(10, floor(log10(abs(num))) - sig_figs + 1) : 0

Order Mag

order_mag = num != 0 ? floor(log10(abs(num))) : 0

Variables

VariableDescriptionDefault
numNumber123456.789
sig_figsSignificant Figures4

How It Works

Significant Figures

Rules for Counting Significant Figures

1. All nonzero digits are significant (123 has 3 sig figs) 2. Zeros between nonzero digits are significant (102 has 3) 3. Leading zeros are NOT significant (0.0045 has 2) 4. Trailing zeros after a decimal point ARE significant (2.50 has 3) 5. Trailing zeros without a decimal point are ambiguous (1500 could be 2, 3, or 4)

Rounding to n Significant Figures

1. Find the first significant digit 2. Count n digits from there 3. Round at that position

Worked Example

Round 123456.789 to 4 significant figures.

num = 123456.789sig_figs = 4
  1. 01The first significant digit is 1
  2. 02Count 4 digits: 1, 2, 3, 4
  3. 03The next digit (5) rounds up
  4. 04Result: 123500

Ready to run the numbers?

Open Significant Figures Calculator