{
  "id": "significant-figures",
  "version": "bd80484c3719",
  "status": "published",
  "name": "Sig Fig Calculator",
  "question": "How many sig figs are in a number?",
  "summary": "Counts the significant figures (sig figs) in a number, rounds a number to any number of them, and adds, subtracts, multiplies, or divides measured numbers under the sig fig rules.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/significant-figures-calculator",
  "markdown": "https://www.acalculator.org/math/significant-figures-calculator.md",
  "kind": "function",
  "method": "Count: every non-zero digit, zeros between them, and trailing zeros after a decimal point. × and ÷: keep the fewest significant figures of the numbers. + and −: round to the last significant place of the less precise number. Halves round away from zero.",
  "assumptions": [
    "Leading zeros never count. Trailing zeros count only when the number has a decimal point (1200 has 2 significant figures, 1200. has 4, 1.200 × 10^3 has 4).",
    "Every number is a measurement; the rules do not treat exact counts or defined constants differently.",
    "Rounding works on the exact value; a value exactly halfway rounds away from zero (2.25 to 2 figures is 2.3), not to the even digit that some chemistry texts use.",
    "The answer is written so that typing it back gives the same significant figures: 2.50 × 10^3 where 2500 would read as 2 figures."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "mode": {
        "title": "What to do",
        "description": "Count the significant figures, round to a number of them, or do arithmetic with them.",
        "type": "string",
        "enum": [
          "count",
          "round",
          "arithmetic"
        ]
      },
      "x": {
        "title": "Number",
        "description": "A measured number as written, such as 0.00450, 1200, 1200. or 1.20e3; trailing zeros matter.",
        "type": "string",
        "maxLength": 60
      },
      "n": {
        "title": "Significant figures",
        "description": "How many significant figures to round to, from 1 to 30.",
        "type": "integer",
        "minimum": 1,
        "maximum": 30
      },
      "op": {
        "title": "Operation",
        "description": "Add, subtract, multiply, or divide the first number by the second.",
        "type": "string",
        "enum": [
          "+",
          "-",
          "*",
          "/"
        ]
      },
      "y": {
        "title": "Second number",
        "description": "The second measured number, written with the digits that were measured.",
        "type": "string",
        "maxLength": 60
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Answer",
      "description": "The rounded number or the result, written so its significant figures are clear: 2.50 × 10^3 where 2500 would not show them.",
      "format": "text"
    },
    "sigFigs": {
      "label": "Significant figures",
      "description": "How many significant figures the number (or the answer) has.",
      "format": "integer"
    },
    "decimals": {
      "label": "Decimal places",
      "description": "How many decimal places the number (or the answer) keeps; 0 when its last significant digit is in the ones place or higher.",
      "format": "integer"
    },
    "scientific": {
      "label": "Scientific notation",
      "description": "The number (or the answer) as a × 10^k, with every significant figure in a.",
      "format": "text"
    },
    "significant": {
      "label": "Significant digits",
      "description": "The digits that count, in order, from the first non-zero digit.",
      "format": "text"
    },
    "exact": {
      "label": "Unrounded result",
      "description": "The exact result before rounding; ≈ marks a value cut to 15 significant figures.",
      "format": "text"
    },
    "rule": {
      "label": "Rule used",
      "description": "Which significant-figure rule sets the precision of the answer.",
      "format": "text"
    },
    "note": {
      "label": "Note",
      "description": "Shown when a whole number has trailing zeros that are not counted.",
      "format": "text"
    },
    "summary": {
      "label": "In short",
      "description": "The answer as one sentence.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "mode": "count",
      "x": "0.004050",
      "n": 2,
      "op": "*",
      "y": "2.5"
    },
    "outputs": {
      "sigFigs": 4,
      "decimals": 6,
      "scientific": "4.050 × 10^-3",
      "significant": "4050",
      "summary": "0.004050 has 4 significant figures."
    },
    "text": "0.004050 has 4 significant figures."
  },
  "examples": [
    {
      "given": {
        "mode": "count",
        "x": "0.004050"
      },
      "expect": {
        "sigFigs": 4,
        "decimals": 6,
        "scientific": "4.050 × 10^-3",
        "significant": "4050"
      },
      "source": "hand calculation in content.mdx: leading zeros do not count, the zero between 4 and 5 and the trailing zero after the point do; rules from OpenStax Chemistry 2e, section 1.5: https://openstax.org/books/chemistry-2e/pages/1-5-measurement-uncertainty-accuracy-and-precision"
    },
    {
      "given": {
        "mode": "count",
        "x": "1200"
      },
      "expect": {
        "sigFigs": 2,
        "scientific": "1.2 × 10^3",
        "note": "The trailing zeros in 1200 are not significant, because it has no decimal point."
      },
      "source": "hand calculation in content.mdx: trailing zeros without a decimal point are not significant (OpenStax Chemistry 2e, 1.5)"
    },
    {
      "given": {
        "mode": "count",
        "x": "1200."
      },
      "expect": {
        "sigFigs": 4,
        "decimals": 0
      },
      "source": "hand calculation in content.mdx: the decimal point makes the trailing zeros significant"
    },
    {
      "given": {
        "mode": "round",
        "x": "0.0034567",
        "n": 3
      },
      "expect": {
        "result": "0.00346",
        "decimals": 5,
        "scientific": "3.46 × 10^-3"
      },
      "source": "hand calculation in content.mdx: 3.4567 × 10^-3 to 3 figures; the next digit is 6, so round up"
    },
    {
      "given": {
        "mode": "round",
        "x": "31.57",
        "n": 2
      },
      "expect": {
        "result": "32"
      },
      "source": "OpenStax Chemistry 2e, section 1.5, Example 1.3 (a): 31.57 to two significant figures is 32"
    },
    {
      "given": {
        "mode": "round",
        "x": "8.1649",
        "n": 3
      },
      "expect": {
        "result": "8.16"
      },
      "source": "OpenStax Chemistry 2e, section 1.5, Example 1.3 (b): 8.1649 to three significant figures is 8.16"
    },
    {
      "given": {
        "mode": "round",
        "x": "0.051065",
        "n": 4
      },
      "expect": {
        "result": "0.05107"
      },
      "source": "hand calculation in content.mdx: the dropped 5 is exactly half, so it rounds away from zero; OpenStax Chemistry 2e Example 1.3 (c) rounds it to the even digit instead (0.05106), a rule this calculator does not use"
    },
    {
      "given": {
        "mode": "round",
        "x": "2468",
        "n": 2
      },
      "expect": {
        "result": "2500",
        "scientific": "2.5 × 10^3"
      },
      "source": "hand calculation in content.mdx: 2468 to 2 figures is 2500, which reads as 2 figures"
    },
    {
      "given": {
        "mode": "round",
        "x": "2496",
        "n": 3
      },
      "expect": {
        "result": "2.50 × 10^3"
      },
      "source": "hand calculation in content.mdx: 2496 to 3 figures is 2500, written 2.50 × 10^3 because 2500 would read as 2 figures"
    },
    {
      "given": {
        "mode": "round",
        "x": "2499.7",
        "n": 4
      },
      "expect": {
        "result": "2.500 × 10^3"
      },
      "source": "hand calculation in content.mdx: 2499.7 to 4 figures is 2500, written 2.500 × 10^3 so the zeros count"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "3.24",
        "op": "*",
        "y": "2.5"
      },
      "expect": {
        "result": "8.1",
        "sigFigs": 2,
        "exact": "8.1",
        "rule": "Multiplication: the answer keeps as many significant figures as the number with the fewest, 2."
      },
      "source": "hand calculation in content.mdx: 3.24 × 2.5 = 8.100, and 2.5 has 2 figures"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "1.0023",
        "op": "+",
        "y": "4.383"
      },
      "expect": {
        "result": "5.385",
        "sigFigs": 4,
        "decimals": 3,
        "exact": "5.3853"
      },
      "source": "OpenStax Chemistry 2e, section 1.5, Example 1.4 (a): 1.0023 g + 4.383 g = 5.385 g"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "486",
        "op": "-",
        "y": "421.23"
      },
      "expect": {
        "result": "65",
        "sigFigs": 2,
        "exact": "64.77"
      },
      "source": "OpenStax Chemistry 2e, section 1.5, Example 1.4 (b): 486 g − 421.23 g = 65 g"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "0.6238",
        "op": "*",
        "y": "6.6"
      },
      "expect": {
        "result": "4.1",
        "sigFigs": 2,
        "exact": "4.11708"
      },
      "source": "OpenStax Chemistry 2e, section 1.5, Example 1.5 (a): 0.6238 cm × 6.6 cm = 4.1 cm²"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "421.23",
        "op": "/",
        "y": "486"
      },
      "expect": {
        "result": "0.867",
        "sigFigs": 3
      },
      "source": "OpenStax Chemistry 2e, section 1.5, Example 1.5 (b): 421.23 g ÷ 486 mL = 0.867 g/mL"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "10",
        "op": "/",
        "y": "3.0"
      },
      "expect": {
        "result": "3",
        "sigFigs": 1,
        "exact": "≈ 3.33333333333333"
      },
      "source": "hand calculation in content.mdx: 10 has 1 significant figure, so 3.333… rounds to 3"
    },
    {
      "given": {
        "mode": "arithmetic",
        "x": "5.0",
        "op": "-",
        "y": "5.0"
      },
      "expect": {
        "result": "0.0",
        "decimals": 1
      },
      "source": "hand calculation in content.mdx: the difference is 0 to the tenths place"
    }
  ],
  "sources": [
    "OpenStax, Chemistry 2e, section 1.5 Measurement Uncertainty, Accuracy, and Precision (significant figures, rounding, and calculations): https://openstax.org/books/chemistry-2e/pages/1-5-measurement-uncertainty-accuracy-and-precision",
    "Wikipedia, Significant figures (identifying significant figures, rounding, and arithmetic): https://en.wikipedia.org/wiki/Significant_figures"
  ],
  "related": [
    "rounding",
    "scientific-notation",
    "decimal",
    "percent-error"
  ],
  "changelog": []
}
