Welcome to the NavList Message Boards.


A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

Compose Your Message

Add Images & Files
    Re: Cosine vs haversine formulas
    From: Frank Reed
    Date: 2017 Nov 18, 19:22 -0800

    "...requires that what ever language you are using be able to handle the acos function well which is not always the case"

    This is a non-issue, and it has been a non-issue for nearly twenty years. Even the link you provided is nearly seven years old. The "best answer" is, itself, copied from http://www.movable-type.co.uk/scripts/latlong.html and references an article written by Roger Sinnott called "Virtues of the Haversine" ...which was published in Sky & Telescope back in 1984. This was a detail that mattered in 1984. Unfortunately, you'll still find people blathering on about it. Some of the comments replying on the link you provided there illustrate the problem (the "blathering" problem!) when they point out that the great circle distance formula (which is the "cosine" formula we're talking about here) can start to become noisy for distances smaller than a few meters. There are lots of ways to manage this, but you can see that things are getting absurd when we're talking about calculating great circle distances from the latitudes and longitudes of objects separated by only a few meters. Incidentally, it's worth remembering that one second of arc on the Earth's surface is about 100 feet or 30 meters. So for great circle problems on the Earth's surface, even in this extreme case, there's not even this trivial issue for angular separations greater than about 0.1 seconds of arc. Similarly, if you're calculating altitudes in celestial navigation or even lunar distances, so long as the angles are larger than that tiny angle, you have nothing to worry about.

    As recently as ten years ago, we could talk about devices that might be a platform for navigationally interesting calculations that lacked built-in math functions. Those days are gone. You can hold a supercomputer in the plam of your hand for $30 retail (a cheap smartphone without phone service). It is trivial to acquire computing devices with incredibly fast, highly-accurate mathematical functions built right in at the chip level. But if you're coding on an old device, or you're interested in historical computation generally, then there is still some relevance.

    Incidentally, this reminded me of something I noticed recently on the US National Weather Service website. If I click on one of the maps to select a "local forecast", it returns the latitude and longitude as lon=-71.38935930175779, lat=41.46786617225138 (example coordinates generated by a click just now). Yes indeed: that's a local forecast! Just how much of a difference in position would change that latitude from 41.46786617225138 to 41.46786617225139... ??

    Frank Reed

    Browse Files

    Drop Files


    What is NavList?

    Join NavList

    (please, no nicknames or handles)
    Do you want to receive all group messages by email?
    Yes No

    You can also join by posting. Your first on-topic post automatically makes you a member.

    Posting Code

    Enter the email address associated with your NavList messages. Your posting code will be emailed to you immediately.

    Email Settings

    Posting Code:

    Custom Index

    Start date: (yyyymm dd)
    End date: (yyyymm dd)

    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site