{
  "schemaVersion": 1,
  "slug": "0-60-calculator",
  "category": "automotive",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "dc4d07384fbe4142f3e0f00283b09fa5fcb3ef85e84492266ad6ff647bbbda19",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/0-60-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": "t = (0.3542 ÷ (P ÷ W))^(1 ÷ 0.88)",
    "vars": [
      [
        "t",
        "Estimated 0–60 mph time (s)"
      ],
      [
        "P",
        "engine horsepower (hp)"
      ],
      [
        "W",
        "vehicle weight (lb)"
      ]
    ],
    "note": "The fit is based on historical light-duty-vehicle data from 1978–2014. Quarter-mile elapsed time and trap speed use separate empirical estimates; all results are approximate."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const mergedResult=(()=>{if((true&&![\"off\", \"on\"].includes(String(comparison))))return{__error:'inputError'};\nif((true&&(!Number.isFinite(horsepower)||horsepower<20||horsepower>3000))||(true&&(!Number.isFinite(weight)||weight<500||weight>12000))||([\"on\"].includes(String(comparison))&&(!Number.isFinite(compareHp)||compareHp<20||compareHp>3000))||([\"on\"].includes(String(comparison))&&(!Number.isFinite(compareWeight)||compareWeight<500||compareWeight>12000)))return{__error:'inputError'};\nif(![horsepower,weight].every(Number.isFinite)||horsepower<20||horsepower>3000||weight<500||weight>12000||!['off','on'].includes(comparison))return{__error:'inputError'};const ratio=horsepower/weight,estimate=r=>Math.pow(.3542/r,1/.88),zeroToSixty=estimate(ratio);let comparePtw=null,compareZeroToSixty=null,difference=null;if(comparison==='on'){if(![compareHp,compareWeight].every(Number.isFinite)||compareHp<20||compareHp>3000||compareWeight<500||compareWeight>12000)return{__error:'inputError'};comparePtw=compareHp/compareWeight;compareZeroToSixty=estimate(comparePtw);difference=compareZeroToSixty-zeroToSixty;}return{zeroToSixty,powerToWeight:ratio,quarterMile:5.825*Math.cbrt(weight/horsepower),trapSpeed:234*Math.cbrt(ratio),comparePtw,compareZeroToSixty,difference};\n})();return mergedResult.__error?{\"zeroToSixty\":null,\"powerToWeight\":null,\"quarterMile\":null,\"trapSpeed\":null,\"comparePtw\":null,\"compareZeroToSixty\":null,\"difference\":null,...mergedResult}:mergedResult;",
    "inputs": [
      {
        "name": "horsepower",
        "type": "number",
        "default": 300,
        "min": 20,
        "max": 3000,
        "step": 5,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "weight",
        "type": "number",
        "default": 3400,
        "min": 500,
        "max": 12000,
        "step": 50,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "comparison",
        "type": "select",
        "default": "off",
        "options": [
          {
            "value": "off"
          },
          {
            "value": "on"
          }
        ],
        "advanced": true
      },
      {
        "name": "compareHp",
        "type": "number",
        "default": 250,
        "min": 20,
        "max": 3000,
        "step": 5,
        "slider": true,
        "advanced": true,
        "requiredValue": true,
        "strictRange": true,
        "showWhen": {
          "comparison": [
            "on"
          ]
        }
      },
      {
        "name": "compareWeight",
        "type": "number",
        "default": 3600,
        "min": 500,
        "max": 12000,
        "step": 50,
        "slider": true,
        "advanced": true,
        "requiredValue": true,
        "strictRange": true,
        "showWhen": {
          "comparison": [
            "on"
          ]
        }
      }
    ],
    "outputs": [
      {
        "name": "zeroToSixty",
        "precision": 2,
        "unit": "s",
        "trimTrailingZeros": true
      },
      {
        "name": "powerToWeight",
        "precision": 4,
        "unit": "hp/lb",
        "trimTrailingZeros": true
      },
      {
        "name": "quarterMile",
        "precision": 2,
        "unit": "s",
        "trimTrailingZeros": true
      },
      {
        "name": "trapSpeed",
        "precision": 1,
        "unit": "mph",
        "trimTrailingZeros": true
      },
      {
        "name": "comparePtw",
        "precision": 4,
        "unit": "hp/lb",
        "optional": true,
        "showWhen": {
          "comparison": [
            "on"
          ]
        }
      },
      {
        "name": "compareZeroToSixty",
        "precision": 2,
        "unit": "s",
        "optional": true,
        "showWhen": {
          "comparison": [
            "on"
          ]
        }
      },
      {
        "name": "difference",
        "precision": 2,
        "unit": "s",
        "optional": true,
        "showWhen": {
          "comparison": [
            "on"
          ]
        }
      }
    ],
    "interpret": null
  }
}
