haversine
std.geometry.haversine · Level L5The central angle between two points on a sphere, given their latitudes and longitudes in radians, by the haversine formula in its atan2 form, which stays accurate for nearby and for nearly antipodal points. Multiply by the radius for the great-circle distance.
Signature
haversine(lat1: f64[n], lon1: f64[n], lat2: f64[n], lon2: f64[n]) → f64[n]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Agrees with the reference
2 * arctan2(sqrt(h), sqrt(1 − h)), h = sin²(Δφ/2) + cos φ1 cos φ2 sin²(Δλ/2)to 80 digits (100-digit arithmetic), on all 40 test cases. - All 158 float64 results inside the running error bound; the closest uses 11% of it.
- Interpreter and NumPy backend return bit-identical results.
- At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 9% of it.
- correctly rounded (the float64 nearest the exact value)
- 49%
- bit-equal to the NumPy formula in float64
- 100%
- largest error, in units in the last place
- 9.79
Identity
sha256:13a8d55738409b46965604691d2856e07fa420aafb3fe40cb270650dd7c34125The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.geometry.haversine · Ω:haversine
- Pins
sha256:c50f8f0008efce17b0a18274f828ff96fab21ea9206c1f71804e36434c92c5dbthis graph alone- Evidence
sha256:7bd1b1115fef00d0f738d6793c9fb5ba539f6c1e6f2d851ca887963fe2dc6fe2the hash of its verification record- Needs
- no capability: a pure function
Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.