help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: distance from Easter Island to Chile


From: Barry Margolin
Subject: Re: distance from Easter Island to Chile
Date: Sun, 20 Apr 2014 03:01:36 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.19905.1397975330.10748.help-gnu-emacs@gnu.org>,
 Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Emanuel Berg <embe8573@student.uu.se>
> > Date: Sun, 20 Apr 2014 02:03:32 +0200
> > 
> > (defun distance (l1-r f1-r l2-r f2-r)
> >   (interactive)
> >   (let ((l1 (degrees-to-radians l1-r))
> >         (f1 (degrees-to-radians f1-r))
> >         (l2 (degrees-to-radians l2-r))
> >         (f2 (degrees-to-radians f2-r)) )
> >     (* 2 6378.1 ; Earth's radius
> >        (asin
> >         (sqrt
> >          (+ (sin2 (/ (- f2 f1) 2))
> >             (* (cos f2) (cos f1) (sin2 (/ (- l2 l1) 2))) ))))))
> 
> This is inaccurate (Earth is not a sphere).

How accurate does your input have to be for that to be a significant? 
I.e. if you're calculating the distance between two cities, and each 
city is 5 miles wide, the distance is +/- 10 miles depending on where in 
the two cities you decide to get the coordinates from. So if the error 
in the formula is 2 miles, it's less than the inaccuracy in the input, 
so the formula should be good enough.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]