Source: https://guthlabs.ai/docs/instruments/great-circle-distance-haversine/implementation/

instrument implementation / implementation-contract

# Great-Circle Distance (Haversine) implementation

A source-bound implementation contract for Great-Circle Distance (Haversine); deployment and executable qualification remain separate.

Status: **VERIFIED_CLEAN**Lifecycle: **implementation-contract**

## Binding contract

This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.

**Record owner**: Guth Instruments

**Lifecycle**: verified-clean

**Evidence ID**: t4-137

**Effect**: Computation or source lookup only

## Input and validation requirements

- Validate latitude range −90° to 90° and longitude range, typically −180° to 180° or a clearly documented equivalent.

- Floating-point rounding can produce a slightly invalid a outside [0,1]; clamp a to [0,1] before sqrt to avoid NaN.

- The distance formula is safe for coincident points, but initial bearing is undefined for coincident points and antipodal points.

- Initial bearing is numerically unstable or undefined at exact pole configurations and must have documented behavior.

- A spherical distance can differ from an ellipsoidal geodesic distance by roughly up to 0.5% depending on the route; it must not be presented as an exact WGS84 ellipsoidal geodesic.

- If a radius is configurable, reject zero or negative radii.

## Required corrections

No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.

## Inspectable interface fixture

The sample below is evidence for interface and validation tests, not a production implementation.

````
{
  "inputs": {
    "lat1_deg": 0,
    "lon1_deg": 0,
    "lat2_deg": 0,
    "lon2_deg": 0,
    "radius_km": 6371.0088
  },
  "expected_outputs": {
    "distance_km": 0,
    "initial_bearing_deg": null
  },
  "working": "Δφ=0 and Δλ=0. a=sin²(0/2)+cos(0)·cos(0)·sin²(0/2)=0+1·1·0=0. atan2(√a,√(1−a))=atan2(0,1)=0. d=2·6371.0088·0=0 km. The initial bearing is undefined because the two points coincide."
}
````

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/great-circle-distance-haversine/>)[02**Mechanism**](<https://guthlabs.ai/docs/instruments/great-circle-distance-haversine/mechanism/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/great-circle-distance-haversine/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche4/tranche4-results.json`
