Algorithms

Test data for the calculations an app does on the device, checked against each authority's own published values.

Sunrise, magnetic declination, grid references and bearings are pure functions: the same input always gives the same answer. So the best way to know an implementation is right is a thorough set of test cases from an authority. This site publishes those cases. It has no code. It links to implementations that pass.

Algorithms

Algorithm Gives Standard Status
Magnetic declination Declination, inclination and field strength for a place and date WMM2025NOAA and BGS Planned
UTM and MGRS Grid references both ways, grid convergence, and typed coordinates parsed Karney's Transverse MercatorNGA, with GeographicLib as the reference program Planned
Bearings Distance and bearing, degrees and mils, compass points, true, magnetic and grid north Great circle on a sphereGeographicLib as the reference program Planned
Astronomical time Julian day, ΔT, sidereal time, and a sky position as azimuth and altitude Meeus, Astronomical AlgorithmsUSNO and IERS as the reference Planned
Sun Rise, set, transit, the three twilights, azimuth and altitude Meeus, Astronomical AlgorithmsUSNO as the reference Planned
Moon Rise, set, transit, illumination, phase, and the dates of the next phases Meeus, Astronomical AlgorithmsUSNO as the reference Planned

How it works

Implementations

Each is a public repo anyone can fork. mise install sets up its tools and mise run test checks it against the current test data, the same way in every language. Each listed implementation shows, for every algorithm, whether it passes, fails or is incomplete. New test cases can turn an implementation red; that’s the prompt to fix it.

RepoStatus
gshaw/algorithms-swiftSwiftIncomplete

Licence

The test data is CC0: copy it into any project with no strings. The site and its tools are MIT. Each source’s own terms are listed with its data.