Haversine formula: Difference between revisions

Content added Content deleted
(Updated both D entries)
(added FunL)
Line 509: Line 509:
println[d-> "km"]
println[d-> "km"]
</lang>
</lang>

=={{header|FunL}}==
<lang funl>import math.*

def haversin( theta ) = (1 - cos( theta ))/2

def radians( deg ) = deg Pi/180

def haversine( (lat1, lon1), (lat2, lon2) ) =
R = 6372.8
h = haversin( radians(lat2 - lat1) ) + cos( radians(lat1) ) cos( radians(lat2) ) haversin( radians(lon2 - lon1) )
2R asin( sqrt(h) )

println( haversine((36.12, -86.67), (33.94, -118.40)) )</lang>

{{out}}

<pre>
2887.259950607111
</pre>


=={{header|Go}}==
=={{header|Go}}==