{
  "id": "feet-and-inches",
  "version": "bfd8a94038f4",
  "status": "published",
  "name": "Feet and Inches Calculator",
  "question": "What is the total in feet and inches?",
  "summary": "Adds or subtracts two lengths in feet and inches, or multiplies or divides one by a number, and shows the result in feet and inches to the nearest fraction of an inch, in inches, feet and centimetres.",
  "category": "construction",
  "url": "https://www.acalculator.org/construction/feet-and-inches-calculator",
  "markdown": "https://www.acalculator.org/construction/feet-and-inches-calculator.md",
  "kind": "function",
  "method": "result = first ± second, or first × number, or first ÷ number; shown as feet, whole inches and the nearest fraction of an inch",
  "assumptions": [
    "1 ft = 12 in, and 1 in = 2.54 cm exactly.",
    "The feet-and-inches result rounds to the nearest fraction chosen; a value exactly halfway rounds up (away from zero). The inch, foot and centimetre results are not rounded.",
    "A negative result (a longer length subtracted) shows a minus sign in front.",
    "Zero feet or zero inches are left out of the feet-and-inches result (3 ft, 5/16 in); a result of zero is 0 in."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "First length",
        "description": "The first length.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0,
        "maximum": 304.8
      },
      "op": {
        "title": "Operation",
        "description": "Add or subtract a second length, or multiply or divide by a number.",
        "type": "string",
        "enum": [
          "add",
          "subtract",
          "multiply",
          "divide"
        ]
      },
      "b": {
        "title": "Second length",
        "description": "The length to add or subtract.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0,
        "maximum": 304.8
      },
      "n": {
        "title": "Number",
        "description": "The number to multiply or divide the first length by.",
        "type": "number",
        "minimum": 0.001,
        "maximum": 1000
      },
      "den": {
        "title": "Round to",
        "description": "The smallest fraction of an inch to show.",
        "type": "string",
        "enum": [
          "2",
          "4",
          "8",
          "16",
          "32",
          "64"
        ]
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Result",
      "description": "The result in feet and inches, to the nearest fraction of an inch chosen.",
      "format": "text"
    },
    "inches": {
      "label": "In inches",
      "description": "The exact result in inches.",
      "format": "quantity",
      "unit": "in"
    },
    "feet": {
      "label": "In feet",
      "description": "The exact result in decimal feet.",
      "format": "quantity",
      "unit": "ft"
    },
    "centimeters": {
      "label": "In centimetres",
      "description": "The exact result in centimetres.",
      "format": "quantity",
      "unit": "cm"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": 1.7145000000000001,
      "op": "add",
      "b": 0.81915,
      "n": 3,
      "den": "16"
    },
    "outputs": {
      "result": "8 ft 3 3/4 in",
      "inches": 2.53365,
      "feet": 2.53365,
      "centimeters": 2.53365
    },
    "text": "The result is 8 ft 3 3/4 in."
  },
  "examples": [
    {
      "given": {
        "a": 1.7145000000000001,
        "op": "add",
        "b": 0.81915,
        "den": "16"
      },
      "expect": {
        "result": "8 ft 3 3/4 in",
        "inches": 2.5336499999999997
      },
      "source": "hand calculation in content.mdx: 5 ft 7 1/2 in + 2 ft 8 1/4 in = 7 ft 15 3/4 in = 8 ft 3 3/4 in"
    },
    {
      "given": {
        "a": 0.9652000000000001,
        "op": "subtract",
        "b": 1.222375,
        "den": "16"
      },
      "expect": {
        "result": "−10 1/8 in",
        "inches": -0.257175
      },
      "source": "hand calculation in content.mdx: 38 in − 48 1/8 in = −10 1/8 in"
    },
    {
      "given": {
        "a": 3.048,
        "op": "divide",
        "n": 2,
        "den": "16"
      },
      "expect": {
        "result": "5 ft",
        "inches": 1.524
      },
      "source": "hand calculation in content.mdx: 120 in ÷ 2 = 60 in = 5 ft exactly"
    },
    {
      "given": {
        "a": 2.1336,
        "op": "divide",
        "n": 3,
        "den": "16"
      },
      "expect": {
        "result": "2 ft 4 in",
        "feet": 0.7112
      },
      "source": "hand calculation in content.mdx: 84 in ÷ 3 = 28 in = 2 ft 4 in"
    },
    {
      "given": {
        "a": 0.0254,
        "op": "divide",
        "n": 3,
        "den": "16"
      },
      "expect": {
        "result": "5/16 in"
      },
      "source": "hand calculation in content.mdx: 1/3 in = 5.33/16 in, which rounds to 5/16 in"
    },
    {
      "given": {
        "a": 1.8567400000000003,
        "op": "multiply",
        "n": 2.5,
        "den": "8"
      },
      "expect": {
        "result": "15 ft 2 3/4 in",
        "inches": 4.64185
      },
      "source": "hand calculation in content.mdx: 73.1 in × 2.5 = 182.75 in = 15 ft 2 3/4 in",
      "tolerance": 1e-12
    }
  ],
  "sources": [
    "NIST SP 811 (2008), Appendix B: 1 ft = 12 in; 1 in = 2.54 cm exactly."
  ],
  "related": [
    "board-foot",
    "stair",
    "square-footage"
  ],
  "changelog": []
}
