Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Calculate distance between two GPS latitude-longitude points.
open System let ``calculate distance`` (p1Latitude,p1Longitude) (p2Latitude,p2Longitude) = let r = 6371.0; // km let dLat = (p2Latitude - p1Latitude) * Math.PI / 180.0 let dLon = (p2Longitude - p1Longitude) * Math.PI / 180.0 let lat1 = p1Latitude * Math.PI / 180.0 let lat2 = p2Latitude * Math.PI / 180.0 let a = Math.Sin(dLat/2.0) * Math.Sin(dLat/2.0) + Math.Sin(dLon/2.0) * Math.Sin(dLon/2.0) * Math.Cos(lat1) * Math.Cos(lat2) let c = 2.0 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1.0-a)) r * c
run
|
edit
|
history
|
help
0
Average Square Error
Recursion in F#
F#: Basic Immutability vs. Mutability
Split list without mutable values
Sending an email
The wonders of F#
Map.except
KR#2
Musical Note Frequencies (Equal temperament)
FizzBuzz without Modulo in F#