{
  "schemaVersion": 1,
  "slug": "cagr-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "a17a317c9d1e0e13477872930f499eb864a30586554c7032c82024cdfd89bb35",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/cagr-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": "CAGR = [(V_e ÷ V_b)^(1 ÷ t) − 1] × 100%",
    "vars": [
      [
        "V_e",
        "Ending value"
      ],
      [
        "V_b",
        "Beginning value"
      ],
      [
        "t",
        "Number of years"
      ],
      [
        "CAGR",
        "Compound annual growth rate"
      ]
    ],
    "note": "CAGR = (ending value ÷ starting value)^(1 ÷ years) − 1. Starting and ending values and years must be positive; CAGR is undefined for zero or negative values."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const ratio=beginValue>0?endValue/beginValue:0;if(beginValue<=0)return{cagr:null,totalGrowth:null,multiple:null,__error:'inputError'};if(endValue<0||years<=0)return{cagr:null,totalGrowth:null,multiple:null,__error:'inputError'};return{cagr:(Math.pow(ratio,1/years)-1)*100,totalGrowth:(ratio-1)*100,multiple:ratio};",
    "inputs": [
      {
        "name": "beginValue",
        "type": "number",
        "default": 10000,
        "min": 0,
        "max": 1000000000,
        "step": 100
      },
      {
        "name": "endValue",
        "type": "number",
        "default": 25000,
        "min": 0,
        "max": 1000000000,
        "step": 100
      },
      {
        "name": "years",
        "type": "number",
        "default": 5,
        "min": 1,
        "max": 100,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "cagr",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "totalGrowth",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "multiple",
        "precision": 2,
        "unit": "x"
      }
    ],
    "interpret": null
  }
}
