{
  "schemaVersion": 1,
  "slug": "lean-body-mass-calculator",
  "category": "health",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "19eb3b15dd72e991637b5b1ee2d4450fcafad8ae58b370c7002ce6805cc8d83f",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/lean-body-mass-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": "LBM = {0.407 × W + 0.267 × H − 19.2, s = ♂; 0.252 × W + 0.473 × H − 48.3, s = ♀}; bodyFat = (W − LBM) ÷ W × 100",
    "vars": [
      [
        "W",
        "body weight (kg)"
      ],
      [
        "H",
        "height (cm)"
      ],
      [
        "LBM",
        "lean body mass (kg)"
      ],
      [
        "bodyFat",
        "body fat percentage"
      ],
      [
        "s",
        "sex (s = ♂ male, s = ♀ female)"
      ]
    ],
    "note": "Boer equation for adults; fat mass and body-fat percentage are derived from the estimate. Inputs that produce an estimate outside 0 < LBM < weight are rejected rather than clamped."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const lean=sex==='female'?0.252*weight+0.473*height-48.3:0.407*weight+0.267*height-19.2;if(!Number.isFinite(lean)||lean<=0||lean>=weight)return{leanMass:null,fatMass:null,bodyFat:null,__error:'inputError'};return{leanMass:lean,fatMass:weight-lean,bodyFat:(weight-lean)/weight*100};",
    "inputs": [
      {
        "name": "sex",
        "type": "select",
        "default": "male",
        "options": [
          {
            "value": "male"
          },
          {
            "value": "female"
          }
        ]
      },
      {
        "name": "weight",
        "type": "number",
        "default": 80,
        "min": 20,
        "max": 400,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "height",
        "type": "number",
        "default": 178,
        "min": 100,
        "max": 250,
        "step": 0.5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "leanMass",
        "precision": 1,
        "unit": "kg"
      },
      {
        "name": "fatMass",
        "precision": 1,
        "unit": "kg"
      },
      {
        "name": "bodyFat",
        "precision": 1,
        "unit": "%"
      }
    ],
    "interpret": null
  }
}
