{
  "id": "inch",
  "version": "f92220fa6386",
  "status": "published",
  "name": "Inch Calculator",
  "question": "How do I add inches and fractions?",
  "summary": "Adds or subtracts lengths in inches and fractions of an inch, or multiplies or divides one by a number, exactly, and shows the result to the nearest 1/8, 1/16, 1/32 or 1/64 inch, in feet and inches, as a decimal, and in centimetres and millimetres.",
  "category": "construction",
  "url": "https://www.acalculator.org/construction/inch-calculator",
  "markdown": "https://www.acalculator.org/construction/inch-calculator.md",
  "kind": "function",
  "method": "Result = a + b, a − b, a × n or a ÷ n in exact fractions of an inch; rounded = the nearest multiple of 1/8, 1/16, 1/32 or 1/64 inch; cm = inches × 2.54.",
  "assumptions": [
    "Every number is exact: 5 3/8 is 43/8, and 0.3 is 3/10. The result is an exact fraction before rounding.",
    "Rounding goes to the nearest step of the chosen fraction; a result exactly halfway between two steps rounds away from zero.",
    "1 inch is 2.54 cm exactly, and 1 foot is 12 inches."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "First length (in)",
        "description": "The first length in inches: a whole number, a fraction or both, like 5 3/8.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      },
      "op": {
        "title": "Operation",
        "description": "Add or subtract a second length, or multiply or divide the first by a number.",
        "type": "string",
        "enum": [
          "add",
          "subtract",
          "multiply",
          "divide"
        ]
      },
      "b": {
        "title": "Second length (in)",
        "description": "The length to add or subtract, in inches.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      },
      "n": {
        "title": "Number",
        "description": "The number to multiply or divide the first length by, like 3 or 1/2.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      },
      "den": {
        "title": "Round to",
        "description": "The fraction of an inch to round the result to, as on a tape measure.",
        "type": "string",
        "enum": [
          "8",
          "16",
          "32",
          "64"
        ]
      }
    }
  },
  "outputs": {
    "rounded": {
      "label": "Result, to the nearest fraction",
      "description": "The result in inches, rounded to the nearest 1/8, 1/16, 1/32 or 1/64 inch (halves away from zero).",
      "format": "text"
    },
    "feetInches": {
      "label": "In feet and inches",
      "description": "The rounded result as feet and inches.",
      "format": "text"
    },
    "exact": {
      "label": "Exact result (in)",
      "description": "The result in inches as an exact fraction in lowest terms.",
      "format": "text"
    },
    "decimal": {
      "label": "Decimal inches",
      "description": "The exact result as a decimal, rounded to 4 decimal places.",
      "format": "number"
    },
    "cm": {
      "label": "Centimetres",
      "description": "The exact result × 2.54, rounded to 3 decimal places.",
      "format": "number"
    },
    "mm": {
      "label": "Millimetres",
      "description": "The exact result × 25.4, rounded to 2 decimal places.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": "5 3/8",
      "op": "add",
      "b": "2 3/4",
      "n": "3",
      "den": "16"
    },
    "outputs": {
      "rounded": "8 1/8",
      "feetInches": "8 1/8 in",
      "exact": "8 1/8",
      "decimal": 8.125,
      "cm": 20.6375,
      "mm": 206.375
    },
    "text": "The result is 8 1/8 in, which is 8 1/8 in to the nearest step (8 1/8 in)."
  },
  "examples": [
    {
      "given": {
        "a": "5 3/8",
        "op": "add",
        "b": "2 3/4",
        "den": "16"
      },
      "expect": {
        "exact": "8 1/8",
        "rounded": "8 1/8",
        "feetInches": "8 1/8 in",
        "decimal": 8.125,
        "cm": 20.6375,
        "mm": 206.375
      },
      "source": "OpenStax, Prealgebra 2e, §4.6 Add and Subtract Mixed Numbers; NIST Handbook 44, Appendix C (1 in = 2.54 cm); hand calculation in content.mdx: 43/8 + 22/8 = 65/8 = 8 1/8"
    },
    {
      "given": {
        "a": "5",
        "op": "divide",
        "n": "3",
        "den": "16"
      },
      "expect": {
        "exact": "1 2/3",
        "rounded": "1 11/16",
        "decimal": 1.6666666666666667
      },
      "source": "OpenStax, Prealgebra 2e, §4.5 Multiply and Divide Mixed Numbers; hand calculation in content.mdx: 5/3 × 16 = 26.67, which rounds to 27/16 = 1 11/16"
    },
    {
      "given": {
        "a": "10",
        "op": "subtract",
        "b": "3 5/16",
        "den": "16"
      },
      "expect": {
        "exact": "6 11/16",
        "rounded": "6 11/16",
        "decimal": 6.6875
      },
      "source": "OpenStax, Prealgebra 2e, §4.6 Add and Subtract Mixed Numbers; hand calculation in content.mdx: 160/16 − 53/16 = 107/16 = 6 11/16"
    },
    {
      "given": {
        "a": "7 1/2",
        "op": "divide",
        "n": "3",
        "den": "16"
      },
      "expect": {
        "exact": "2 1/2",
        "rounded": "2 1/2",
        "decimal": 2.5
      },
      "source": "OpenStax, Prealgebra 2e, §4.5 Multiply and Divide Mixed Numbers; hand calculation in content.mdx: 15/2 ÷ 3 = 5/2"
    },
    {
      "given": {
        "a": "1/32",
        "op": "add",
        "b": "0",
        "den": "16"
      },
      "expect": {
        "exact": "1/32",
        "rounded": "1/16",
        "feetInches": "1/16 in"
      },
      "source": "Hand calculation in content.mdx: 1/32 × 16 = 0.5, a half, which rounds away from zero to 1/16 (OpenStax, Prealgebra 2e, §5.1)"
    },
    {
      "given": {
        "a": "30 1/2",
        "op": "add",
        "b": "11 3/4",
        "den": "16"
      },
      "expect": {
        "exact": "42 1/4",
        "feetInches": "3 ft 6 1/4 in",
        "cm": 107.315
      },
      "source": "NIST Handbook 44, Appendix C (1 ft = 12 in, 1 in = 2.54 cm); hand calculation in content.mdx: 61/2 + 47/4 = 169/4 = 42 1/4 in = 3 ft 6 1/4 in"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, §4.5 Multiply and Divide Mixed Numbers and §4.6 Add and Subtract Mixed Numbers. https://openstax.org/books/prealgebra-2e/pages/4-6-add-and-subtract-mixed-numbers",
    "NIST Handbook 44 (2024), Appendix C, General Tables of Units of Measurement: 1 in = 2.54 cm exactly; 1 ft = 12 in. https://www.nist.gov/pml/owm/nist-handbook-44-current-edition"
  ],
  "related": [
    "feet-and-inches",
    "square-footage"
  ],
  "changelog": []
}
