{
  "schemaVersion": 1,
  "slug": "speed-calculator",
  "category": "conversion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0bc8e6fde4da8b968b83b30a67add92afa9d14fc3c65ba91ef3901ce1219f642",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/speed-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": "v = d × k_d ÷ (t × k_t); km/h = 3.6v, mph = 2.23694v, kn = 1.94384v",
    "vars": [
      [
        "d",
        "Distance value"
      ],
      [
        "t",
        "Time value"
      ],
      [
        "k_d",
        "Distance→metres factor"
      ],
      [
        "k_t",
        "Time→seconds factor"
      ]
    ],
    "note": "Factors: km 1000, mi 1609.344, yd 0.9144, ft 0.3048, nmi 1852; min 60, h 3600. Pace shown as min:sec per km."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "NIST SP 811 — Conversion factors by quantity",
        "url": "https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b9"
      }
    ],
    "basis": "Convert speed via metres per second, including international miles and nautical miles.",
    "limitations": "Only the displayed unit definitions are converted; rounding and measurement uncertainty are separate.",
    "implementationHash": "0bc8e6fde4da8b968b83b30a67add92afa9d14fc3c65ba91ef3901ce1219f642",
    "domain": "conversion"
  },
  "contract": {
    "compute": "if((!Number.isFinite(distance)||distance<0||distance>1000000000000)||(!Number.isFinite(time)||time<0.0001||time>1000000000)||![\"m\",\"km\",\"mi\",\"yd\",\"ft\",\"nmi\"].includes(distUnit)||![\"s\",\"min\",\"h\"].includes(timeUnit))return {\"result\":null,\"mps\":null,\"kmh\":null,\"mph\":null,\"knots\":null,\"pace\":null,\"__error\":\"inputError\"};if(![\"mps\",\"kmh\",\"mph\",\"knots\"].includes(resultUnit))return {\"result\":null,\"mps\":null,\"kmh\":null,\"mph\":null,\"knots\":null,\"pace\":null,\"__error\":\"inputError\"};const out=(function(distance,distUnit,time,timeUnit){const D={m:1,km:1000,mi:1609.344,yd:0.9144,ft:0.3048,nmi:1852}; const T={s:1,min:60,h:3600}; if(distance<=0||time<=0||!D[distUnit]||!T[timeUnit]) return { mps: null, kmh: null, mph: null, knots: null, pace: null, __error: 'inputError' }; const v=distance*D[distUnit]/(time*T[timeUnit]); const s=Math.round((1000/v)/60*60); return {mps:v,kmh:v*3.6,mph:v*2.2369362921,knots:v*1.9438444924,pace:Math.floor(s/60)+':'+String(s%60).padStart(2,'0')};})(distance,distUnit,time,timeUnit);if(out.__error)return {...{\"result\":null,\"mps\":null,\"kmh\":null,\"mph\":null,\"knots\":null,\"pace\":null},...out};out.mph=out.mps/0.44704;out.knots=out.mps/(1852/3600);out.result=out[resultUnit];out.__resultUnit={\"m\":\"m\",\"km\":\"km\",\"mi\":\"mi\",\"yd\":\"yd\",\"ft\":\"ft\",\"nmi\":\"nmi\",\"s\":\"s\",\"min\":\"min\",\"h\":\"h\",\"mps\":\"m/s\",\"kmh\":\"km/h\",\"mph\":\"mph\",\"knots\":\"kn\"}[resultUnit];return out;",
    "inputs": [
      {
        "name": "distance",
        "type": "number",
        "default": 100,
        "min": 0,
        "max": 1000000000000,
        "step": 0.01,
        "requiredValue": true,
        "strictRange": true,
        "unitField": "distUnit",
        "unitLabels": {
          "m": "m",
          "km": "km",
          "mi": "mi",
          "yd": "yd",
          "ft": "ft",
          "nmi": "nmi",
          "s": "s",
          "min": "min",
          "h": "h",
          "mps": "m/s",
          "kmh": "km/h",
          "mph": "mph",
          "knots": "kn"
        }
      },
      {
        "name": "distUnit",
        "type": "select",
        "default": "m",
        "options": [
          {
            "value": "m"
          },
          {
            "value": "km"
          },
          {
            "value": "mi"
          },
          {
            "value": "yd"
          },
          {
            "value": "ft"
          },
          {
            "value": "nmi"
          }
        ]
      },
      {
        "name": "time",
        "type": "number",
        "default": 9.58,
        "min": 0.0001,
        "max": 1000000000,
        "step": 0.01,
        "requiredValue": true,
        "strictRange": true,
        "unitField": "timeUnit",
        "unitLabels": {
          "m": "m",
          "km": "km",
          "mi": "mi",
          "yd": "yd",
          "ft": "ft",
          "nmi": "nmi",
          "s": "s",
          "min": "min",
          "h": "h",
          "mps": "m/s",
          "kmh": "km/h",
          "mph": "mph",
          "knots": "kn"
        }
      },
      {
        "name": "timeUnit",
        "type": "select",
        "default": "s",
        "options": [
          {
            "value": "s"
          },
          {
            "value": "min"
          },
          {
            "value": "h"
          }
        ]
      },
      {
        "name": "resultUnit",
        "type": "select",
        "default": "mps",
        "options": [
          {
            "value": "mps"
          },
          {
            "value": "kmh"
          },
          {
            "value": "mph"
          },
          {
            "value": "knots"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "result",
        "precision": 4,
        "trimTrailingZeros": true,
        "unitField": "__resultUnit",
        "notation": "auto"
      },
      {
        "name": "mps",
        "precision": 3,
        "unit": "m/s",
        "showWhen": {
          "resultUnit": [
            "kmh",
            "mph",
            "knots"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "kmh",
        "precision": 3,
        "unit": "km/h",
        "showWhen": {
          "resultUnit": [
            "mps",
            "mph",
            "knots"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "mph",
        "precision": 3,
        "unit": "mph",
        "showWhen": {
          "resultUnit": [
            "mps",
            "kmh",
            "knots"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "knots",
        "precision": 3,
        "unit": "kn",
        "showWhen": {
          "resultUnit": [
            "mps",
            "kmh",
            "mph"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "pace",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
