From: Jarkko Hietaniemi Date: Wed, 18 Aug 1999 08:27:22 +0000 (+0000) Subject: Warn about small spherical distances. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=41bd693c38b93b50972065296573f26c13cc43d1;p=p5sagit%2Fp5-mst-13.2.git Warn about small spherical distances. p4raw-id: //depot/cfgperl@4003 --- diff --git a/lib/Math/Trig.pm b/lib/Math/Trig.pm index 924286d..d987b5c 100644 --- a/lib/Math/Trig.pm +++ b/lib/Math/Trig.pm @@ -409,7 +409,16 @@ To calculate the distance between London (51.3N 0.5W) and Tokyo (35.7N $km = great_circle_distance(@L, @T, 6378); The answer may be off by few percentages because of the irregular -(slightly aspherical) form of the Earth. +(slightly aspherical) form of the Earth. The used formula + + lat0 = 90 degrees - phi0 + lat1 = 90 degrees - phi1 + d = R * arccos(cos(lat0) * cos(lat1) * cos(lon1 - lon01) + + sin(lat0) * sin(lat1)) + +is also somewhat unreliable for small distances (for locations +separated less than about five degrees) because it uses arc cosine +which is rather ill-conditioned for values close to zero. =head1 BUGS