{
  "schemaVersion": 1,
  "slug": "debt-to-income-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "8d4da73c22396b653ef208ea201c7f1ec6ef6e9a4f9951cd053000184d719f5f",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/debt-to-income-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": "DTI = 100D ÷ I; D_max = 0.36 I",
    "vars": [
      [
        "I",
        "Monthly income"
      ],
      [
        "D",
        "Monthly debt payments"
      ],
      [
        "DTI",
        "Debt-to-income (%)"
      ],
      [
        "D_max",
        "Max debt at 36%"
      ]
    ],
    "note": "DTI = monthly debt ÷ gross monthly income; the displayed 36% amount is a reference scenario, not a lender rule."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const values=[monthlyIncome,monthlyDebt];if(values.some(v=>!Number.isFinite(v)||v<0)||monthlyIncome<=0)return {dti:null,maxDebt:null,__error:'inputError'};return {dti:monthlyDebt/monthlyIncome*100,maxDebt:monthlyIncome*0.36};",
    "inputs": [
      {
        "name": "monthlyIncome",
        "type": "number",
        "default": 5000,
        "min": 0,
        "max": 10000000,
        "step": 100
      },
      {
        "name": "monthlyDebt",
        "type": "number",
        "default": 1500,
        "min": 0,
        "max": 10000000,
        "step": 50
      }
    ],
    "outputs": [
      {
        "name": "dti",
        "precision": 1,
        "unit": "%"
      },
      {
        "name": "maxDebt",
        "precision": 2,
        "unit": "$"
      }
    ],
    "interpret": [
      {
        "max": 36,
        "key": "good"
      },
      {
        "max": 44,
        "key": "caution"
      },
      {
        "max": 1000000000,
        "key": "high"
      }
    ]
  }
}
