Back to the index
#
Distance and Direction for the HP-32SII

Written by Dave Coffin around 1992.

##
Overview

This program calculates the distance and initial heading of
the shortest path between two points on the Earth's surface.
##
Usage

A Moslem must always face toward Mecca during prayer.
Which way should a Moslem in Boston face?
XEQ D
N? 42.3566 Downtown Boston
E? -71.0569 Always negative in USA!!
N? 21.426 Mecca, Saudi Arabia
E? 39.838
5397.33132593 Distance in nautical miles
x<>y
60.420494571 Compass heading (30 degrees north of east)

This is counter-intuitive because, on a flat map of the world,
Mecca appears far to the east and a little south of Boston.
But if you find these two cities on a globe and connect them
with a tight string, you can see that the shortest path goes
north before it goes south.
##
Program

HP 35s users must read this!!

Distance output is in nautical miles. Change line D30 to
111.12 for kilometers, or 69.046767 for statute miles.

D01 LBL D
D02 DEG
D03 INPUT N
D04 STO X
D05 INPUT E
D06 INPUT N
D07 1
D08 θ,r→y,x
D09 INPUT E
D10 R↑
D11 -
D12 x<>y
D13 θ,r→y,x
D14 R↑
D15 x<>y
D16 y,x→θ,r
D17 x<>y
D18 RCL- X
D19 x<>y
D20 θ,r→y,x
D21 180
D22 R↓
D23 R↓
D24 +/-
D25 y,x→θ,r
D26 R↓
D27 -
D28 x<>y
D29 ACOS
D30 60
D31 ×
D32 RTN
HP-32SII: checksum = AAAA, length = 48.0
HP-33S: checksum = EE88, length = 132
HP-35S: checksum = EA58, length = 102