Haversine formula: Difference between revisions

Content added Content deleted
m (→‎{{header|Ruby}}: Adjust earth radius to recommended)
Line 2,929: Line 2,929:
return d
return d
</syntaxhighlight>
</syntaxhighlight>

=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
{| class="wikitable"
! Code
! Comments
|-
|
ROT - 2 / DEG SIN SQ OVER COS * 3 PICK COS *
ROT ROT - 2 / SIN SQ + √ RAD ASIN 6372.8 * 2 *
≫ 'AHAV' STO
|
''( lat1 lon1 lat2 lon2 -- distance )''
Start by the end of the formula, in degree mode
Switch to radian mode to compute Arcsin
|}
The following line of command delivers what is required:
36.12 -86.67 33.94 -118.4 AHAV
Due to the uncertainty in values of Earth radius and airports coordinates, the result shall be announced as 2887 ± 1 km even if the calculation provides many digits after the decimal point
{{out}}
<pre>
1: 2887.25995061
</pre>


=={{header|Ruby}}==
=={{header|Ruby}}==