haversine

std.geometry.haversine · Level L5

The 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.

h = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2); angle = 2·atan2(√h, √(1 − h))

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.

lat1f64[n]lat2f64[n]lon1f64[n]lon2f64[n]SubtractdlatCosc1Cosc20.5SubtractdlonMultiplyhlatMultiplyccMultiplyhlonSinslatSinslonMultiplyslat2Multiplyslon2Multiplyterm1.0Addh0.0Subtractrest_rawSqrtshMaximumrestSqrtsrAtan2a2.0Multiplyangleanglef64[n]
  • 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.
Accuracy in detail
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

Calls
—
Called by
—
sha256:13a8d55738409b46965604691d2856e07fa420aafb3fe40cb270650dd7c34125

The 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.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.