{
  "schemaVersion": 1,
  "slug": "screen-size-calculator",
  "category": "photography",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "27a8d1f00523a45d3fa9497dd93128de7400cdd89c3f387ec53a88dda9ab116b",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/screen-size-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "h = D ÷ √(1 + a²); w = ah; PPI = R ÷ w; d = 1.6D ÷ 12",
    "vars": [
      [
        "D",
        "Diagonal (in)"
      ],
      [
        "a",
        "Aspect ratio (e.g. 16 ÷ 9)"
      ],
      [
        "w/h",
        "Screen width/height (in)"
      ],
      [
        "R",
        "Horizontal pixels"
      ],
      [
        "PPI",
        "Pixels per inch"
      ]
    ],
    "note": "Dimensions are inferred from diagonal and aspect ratio; PPI uses entered horizontal pixels divided by screen width. Viewing-distance output is a fixed 1.6× diagonal reference, not an individualized recommendation."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const parts = String(aspect).split(':').map(Number); const ar = parts.length === 2 && parts[0] > 0 ? parts[0]/parts[1] : 16/9; const h = diagonal/Math.sqrt(1 + ar*ar); const w = h*ar; const resH = resolution/ar; return { width: w, height: h, widthCm: w*2.54, heightCm: h*2.54, area: w*h, pixelsPerInch: w > 0 ? resolution/w : 0, viewingDistance: diagonal*1.6/12 };",
    "inputs": [
      {
        "name": "diagonal",
        "type": "number",
        "default": 55,
        "min": 1,
        "max": 500,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "aspect",
        "type": "select",
        "default": "16:9",
        "options": [
          {
            "value": "16:9"
          },
          {
            "value": "21:9"
          },
          {
            "value": "4:3"
          },
          {
            "value": "32:9"
          },
          {
            "value": "16:10"
          }
        ]
      },
      {
        "name": "resolution",
        "type": "number",
        "default": 3840,
        "min": 320,
        "max": 20000,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "width",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "height",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "widthCm",
        "precision": 1,
        "unit": "cm"
      },
      {
        "name": "heightCm",
        "precision": 1,
        "unit": "cm"
      },
      {
        "name": "area",
        "precision": 1,
        "unit": "sq in"
      },
      {
        "name": "pixelsPerInch",
        "precision": 1,
        "unit": "ppi"
      },
      {
        "name": "viewingDistance",
        "precision": 1,
        "unit": "ft"
      }
    ],
    "interpret": null
  }
}
