{
  "schemaVersion": 1,
  "slug": "triangle-area-calculator",
  "category": "geometry",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "4007b88eeb0f762b95102af0067dd80f78044e6654156ed7c1f1902007c926b4",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/triangle-area-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": "A = √(p(p−a)(p−b)(p−c)); p = (a+b+c) ÷ 2",
    "vars": [
      [
        "a,b,c",
        "Side lengths"
      ],
      [
        "p",
        "Semiperimeter"
      ],
      [
        "A",
        "Area"
      ]
    ],
    "note": "Enter three positive side lengths in the same arbitrary unit u; lengths are in u and area in u². No unit is selected or converted."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "Wolfram MathWorld — Heron formula",
        "url": "https://mathworld.wolfram.com/HeronsFormula.html"
      }
    ],
    "basis": "s = (a + b + c)/2; area = sqrt(s(s - a)(s - b)(s - c)).",
    "limitations": "All sides must be positive and satisfy the strict triangle inequality.",
    "implementationHash": "4007b88eeb0f762b95102af0067dd80f78044e6654156ed7c1f1902007c926b4",
    "domain": "math"
  },
  "contract": {
    "compute": "const sides=[sideA,sideB,sideC].sort((a,b)=>a-b);const [a,b,d]=sides;if(a<=0||a+b<=d) return {area:null,perimeter:null,semiPerimeter:null,isRightTriangle:null,__error:'inputError'}; const perimeter=a+b+d,sp=perimeter/2,area=Math.sqrt(sp*(sp-a)*(sp-b)*(sp-d));return {area,perimeter,semiPerimeter:sp,isRightTriangle:Math.abs(a*a+b*b-d*d)<1e-6?1:0};",
    "inputs": [
      {
        "name": "sideA",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 1000000000,
        "step": 0.001
      },
      {
        "name": "sideB",
        "type": "number",
        "default": 4,
        "min": 0,
        "max": 1000000000,
        "step": 0.001
      },
      {
        "name": "sideC",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 1000000000,
        "step": 0.001
      }
    ],
    "outputs": [
      {
        "name": "area",
        "precision": 4,
        "unit": "u²"
      },
      {
        "name": "perimeter",
        "precision": 4,
        "unit": "u"
      },
      {
        "name": "semiPerimeter",
        "precision": 4,
        "unit": "u"
      },
      {
        "name": "isRightTriangle",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
