ON 20060426@10:04:19 PM at page: http://techref.massmind.org/techref/member/EDG-TK-FKI/index.htm#38833.9196643519 David A Cary[DAV-MP-E62a] Code:
On page
http://techref.massmind.org/techref/piclist/questions.htm
you ask how to calculate the great-circle distance with a PIC18F452.
(Microchip says the PIC18F452 is "Not Recommended for new design ... Please consider using device PIC18F4520").

The article
http://en.wikipedia.org/wiki/Great-circle_distance
recommends using this formula for small distances:

A = LAT1, B = LONG1
C = LAT2, D = LONG2
// (all in radians; multiply angles in degrees by pi/180 to get angles in radians)

// find angular distance S in radians
T = ( sin( (C-A)/2 ) )^2 + cos(A)*cos(C)*( sin( (D-B)/2 ) )^2;
S = 2*arcsin( sqrt( T ) );
// convert angular distance to distance in meters
// (By definition, Earth has a circumference of 40 Megameters)
distance = S * (40_000_000 / (2*pi));

So ... What exactly seems to be the problem?
If you are writing the program from scratch in assembly language,
or C or BASIC compiler doesn't already include a floating-point or fixed-point trig library, you'll need an implementation of "sqrt()", "sin()", "cos()", and "arcsin()" of "enough" accuracy.
Oh, and also "*" and "+".
(This program, like all PIC programs I've written so far, doesn't need a "/" routine -- "/" is in the source code, but it is pre-computed by my desktop machine at compile time).

I suspect all the routines you might need are in the app notes mentioned at
http://techref.massmind.org/techref/method/math/fixed.htm
.

Possibly faster and/or smaller code, written after (?) those app notes were published, are listed at
square root in assembly language:
/techref/microchip/math/sqrt/
trig functions in assembly language:
/techref/microchip/math/index.htm

Do you need more accuracy than those implementations give?
Is there something we need to fix about the way those functions "fit together" ?

What is the size of the resulting program, compared to the 32 KBytes of program space in the PIC18F4520 ?
ON 20060427 at page: http://www.massmind.org/techref/member/EDG-TK-FKI/index.htm someone[--] edited the page. Difference: "R:\bak\H\techref\member\EDG-TK-FKI\index.htm.20060427.dif"