Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
geosailing3
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
case1
145164176.0 Ops/sec
case2
5583870.5 Ops/sec
case3
801120.6 Ops/sec
case4
660700.4 Ops/sec
case5
726173.9 Ops/sec
case6
144935728.0 Ops/sec
case7
160317968.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function geosailing(latA, lngA, latB, lngB) { try { return (Math.acos(Math.sin(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.sin(Math.atan(Math.tan(latB * (Math.PI / 180)))) + Math.cos(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.cos(Math.atan(Math.tan(latB * (Math.PI / 180)))) * Math.cos(lngA * (Math.PI / 180) - lngB * (Math.PI / 180))) * 6371.008); } catch { return 0; } } var dist_cache = {}; function geosailing2(latA, lngA, latB, lngB) { if (dist_cache[latA] && dist_cache[latA][lngA] && dist_cache[latA][lngA][latB] && dist_cache[latA][lngA][latB][lngB]) { return dist_cache[latA][lngA][latB][lngB]; } else { var dist = Math.acos(Math.sin(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.sin(Math.atan(Math.tan(latB * (Math.PI / 180)))) + Math.cos(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.cos(Math.atan(Math.tan(latB * (Math.PI / 180)))) * Math.cos(lngA * (Math.PI / 180) - lngB * (Math.PI / 180))) * 6371.008; if (!dist_cache[latA]) dist_cache[latA] = {}; if (!dist_cache[latA][lngA]) dist_cache[latA][lngA] = {}; if (!dist_cache[latA][lngA][latB]) dist_cache[latA][lngA][latB] = {}; dist_cache[latA][lngA][latB][lngB] = dist; return dist; } } function geosailing3(a,b,c,d){ with(Math)return acos(sin(a*PI/180)*sin(c*PI/180)+cos(a*PI/180)*cos(c*PI/180)*cos(b*PI/180-d*PI/180))*6371.008 } function geosailing4(a,b,c,d){ with(Math)return acos(sin(a*(i=PI/180))*sin(c*i)+cos(a*i)*cos(c*i)*cos(b*i-d*i))*6371.008 } function geosailing5(a,b,c,d){ with(Math)return acos(sin(a*=(i=PI/180))*sin(c*=i)+cos(a)*cos(c)*cos(b*i-d*i))*6371.008 } const R = Math.PI / 180; function geosailing6(lat1, lng1, lat2, lng2) { lat1 *= R; lng1 *= R; lat2 *= R; lng2 *= R; return 6371 * Math.acos(Math.cos(lat1) * Math.cos(lat2) * Math.cos(lng2 - lng1) + Math.sin(lat1) * Math.sin(lat2)); } function geosailing7(lat1,lon1,lat2,lon2) { var a = Math.pow(Math.sin((lon2 - lon1) * Math.PI / 360), 2) + Math.pow(Math.sin((lat2 - lat1) * Math.PI / 360), 2) * Math.cos(lon1 * Math.PI / 180) * Math.cos(lon2 * Math.PI / 180); return 12746 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); };
Tests:
case1
geosailing(20.24,50.11,2.88,9.23)
case2
geosailing2(20.24,50.11,2.88,9.23)
case3
geosailing3(20.24,50.11,2.88,9.23)
case4
geosailing4(20.24,50.11,2.88,9.23)
case5
geosailing5(20.24,50.11,2.88,9.23)
case6
geosailing6(20.24,50.11,2.88,9.23)
case7
geosailing7(20.24,50.11,2.88,9.23)