In the fields of science, engineering, and mathematics, significant figures are the digits in a number that carry meaningful contributions to its measurement precision. This includes all digits except for leading zeros, which serve only as placeholders to indicate the scale of the number.
The Core Rules of Significant Figures
Identifying significant figures is essential for maintaining accuracy during complex calculations. Here are the five fundamental rules:
Non-zero digits are always significant: For example, 543 has three significant figures.
Zeros between non-zero digits are significant: In the number 4008, all four digits are significant (often called "sandwich zeros").
Leading zeros are NEVER significant: In 0.0025, only the '25' is significant. The zeros simply indicate the decimal position.
Trailing zeros with a decimal point are significant: 45.00 has four significant figures because the decimal implies measurement precision to the hundredths place.
Trailing zeros in a whole number are ambiguous: In the number 5000, there may be one, two, three, or four significant figures. To avoid confusion, scientific notation (5.0 x 10³) is preferred.
Practical Examples
Let's look at how these rules apply in real-world scenarios:
Example 1: 0.00050210 — This has 5 significant figures (5, 0, 2, 1, 0). The leading zeros are ignored, the middle zero is "sandwiched," and the final zero is after a decimal point.
Example 2: 1,200,000 — Without a decimal, this has 2 significant figures. If written as 1,200,000., it would have 7.
Example 3: 1.000 — This has 4 significant figures, indicating high precision.
Why Sig Figs Matter in Calculations
When performing math with measured values, your result cannot be more precise than your least precise measurement.
For Multiplication and Division, the result should have the same number of significant figures as the measurement with the fewest significant figures.
For Addition and Subtraction, the result should have the same number of decimal places as the measurement with the fewest decimal places.
function calculateSigFigs() {
var input = document.getElementById("numberInput").value.trim();
var roundTo = parseInt(document.getElementById("roundInput").value);
var resultsDiv = document.getElementById("results");
if (input === "") {
resultsDiv.style.display = "none";
return;
}
var sigCount = countSignificantFigures(input);
var rounded = "N/A";
var scientific = "N/A";
if (!isNaN(parseFloat(input))) {
var num = parseFloat(input);
// Handle scientific notation output
scientific = num.toExponential();
// Handle rounding if roundTo is provided
if (!isNaN(roundTo) && roundTo > 0) {
rounded = roundToSignificantFigures(num, roundTo);
// Re-format scientific for the rounded version if needed
scientific = parseFloat(rounded).toExponential(roundTo – 1);
} else {
rounded = "Enter 'Round to' value";
}
}
var decimalMatch = input.split('.');
var decimals = decimalMatch.length > 1 ? decimalMatch[1].length : 0;
document.getElementById("sigCount").innerText = sigCount;
document.getElementById("roundedVal").innerText = rounded;
document.getElementById("scientificVal").innerText = scientific;
document.getElementById("decimalCount").innerText = decimals;
resultsDiv.style.display = "block";
}
function countSignificantFigures(n) {
var str = n.toString().toLowerCase().replace(/[eE].*$/, ""); // Remove scientific notation exponent
var cleaned = str.replace(/^-/, ""); // Remove negative sign
if (cleaned.indexOf('.') !== -1) {
// Has a decimal point
var parts = cleaned.split('.');
var before = parts[0];
var after = parts[1];
if (parseInt(before) === 0 || before === "") {
// Leading zeros case: e.g., 0.00123
var nonZeroIndex = after.search(/[1-9]/);
if (nonZeroIndex === -1) return 0; // All zeros
return after.length – nonZeroIndex;
} else {
// Normal decimal case: e.g., 12.001 or 12.30
return before.length + after.length;
}
} else {
// No decimal point
// Rule: Trailing zeros in a whole number are usually not significant
var noTrailingZeros = cleaned.replace(/0+$/, "");
if (noTrailingZeros === "") return 0;
return noTrailingZeros.length;
}
}
function roundToSignificantFigures(num, n) {
if (num === 0) return 0;
var d = Math.ceil(Math.log10(num < 0 ? -num : num));
var power = n – d;
var magnitude = Math.pow(10, power);
var shifted = Math.round(num * magnitude);
var result = shifted / magnitude;
// Formatting logic to ensure trailing zeros are kept
// e.g., rounding 1.002 to 3 sig figs should give 1.00
var resultStr = result.toString();
var currentSigFigs = countSignificantFigures(resultStr);
if (currentSigFigs < n) {
if (resultStr.indexOf('.') === -1) {
resultStr += ".";
}
while (countSignificantFigures(resultStr) < n) {
resultStr += "0";
}
}
return resultStr;
}