#!/usr/bin/perl
use strict;
use warnings;
use Geo::Distance;
my $geo = Geo::Distance->new;
for (qw/tv hsin polar cos gcd mt/) {
$geo->formula($_);
print $_, " ", $geo->distance('mile', 39.175555,-76.671388 => 33.9
+42222,-118.407222), "\n";
}
__DATA__
tv 9537.71241222878
hsin 2881.23714304656
polar 3114.47526297555
cos 2881.23714304656
gcd 12438.0476860875-9076.08896733252i
mt 2881.23714304656
Geo::Distance::XS
use strict;
use warnings;
use Geo::Distance::XS;
my $geo = Geo::Distance->new;
for (qw/tv hsin polar cos gcd mt/) {
$geo->formula($_);
print $_, " ", $geo->distance('mile', 39.175555,-76.671388 => 33.9
+42222,-118.407222), "\n";
}
__DATA__
tv 9538.66771882495
hsin 2881.23714304656
polar 3114.47526297555
cos 2881.23714304656
gcd 2881.23714304656
mt 2881.23714304656
Update: Ok, I am a freaking idiot who should not write code while up late at night. I swapped long/lat. This was further complicated by tye's method having in the same order as I was using which produces the correct result. I need to have my JAPH card revoked. Please forgive my gigantic stupidity.
|