From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: distance from Easter Island to Chile Date: Sun, 20 Apr 2014 09:28:23 +0300 Message-ID: <83sip8fraw.fsf@gnu.org> References: <87mwfguasr.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1397975346 26194 80.91.229.3 (20 Apr 2014 06:29:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Apr 2014 06:29:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 20 08:29:00 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WblFM-0000jF-84 for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Apr 2014 08:29:00 +0200 Original-Received: from localhost ([::1]:44589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WblFL-0001EN-Nm for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Apr 2014 02:28:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WblF5-0001E3-Mc for help-gnu-emacs@gnu.org; Sun, 20 Apr 2014 02:28:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WblF0-0005Ql-ET for help-gnu-emacs@gnu.org; Sun, 20 Apr 2014 02:28:43 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:47172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WblF0-0005Qh-6L for help-gnu-emacs@gnu.org; Sun, 20 Apr 2014 02:28:38 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N4B00L00GGI7H00@a-mtaout22.012.net.il> for help-gnu-emacs@gnu.org; Sun, 20 Apr 2014 09:28:36 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N4B00LN3GNNAD00@a-mtaout22.012.net.il> for help-gnu-emacs@gnu.org; Sun, 20 Apr 2014 09:28:36 +0300 (IDT) In-reply-to: <87mwfguasr.fsf@nl106-137-194.student.uu.se> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97248 Archived-At: > From: Emanuel Berg > 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). See http://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid for some theory and more accurate formulas. A very accurate method is described in http://en.wikipedia.org/wiki/Vincenty%27s_formulae (you need the "inverse problem").