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
- Every expected value comes from outside. An authority’s published values, such as NOAA’s for the magnetic model, or a trusted reference program run for the purpose, such as GeographicLib. Never a guess by a person or a language model.
- Each algorithm has one file of test cases, with a tolerance for each output and every edge case named: polar night, the Svalbard grid zones, a bearing of 359.6° written as 000°.
- An implementation is right when it passes the file. How it was written doesn’t matter. Many will be written by agents from the page.
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.
| Repo | Status |
|---|---|
| gshaw/algorithms-swiftSwift | Incomplete |
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.