U16 funcs_u16milesBetween() 	// Returns 16-bit unsigned integer
{
	I16 deltaLat;	// 16-bit integer
	I16 deltaLon;
	U8 index;	// 8-bit unsigned integer
	I32 temp;	// 32-bit integer

	deltaLat = stnLat-myLat;
	deltaLon = stnLon-myLon;
// Index into cosine correction table.
// Cosine table gives ratio, assuming a divide by 256.
	index = (stnLat+myLat) >> 7;
	deltaLon = (I32)deltaLon*cosLookup[index] >> 8;
	temp = (I32)deltaLat*(I32)deltaLat+(I32)deltaLon*(I32)deltaLon;
// Convert degrees to miles by multiplying by 69/50. To avoid
// division, use 11/8, which is extremely close.
	temp = (i32Sqrt(temp)*11) >> 3;	// Distance in miles
	return (U16)temp;
}
Listing 1—You can calculate the distance between a station and the current GPS position. Note that when a routine is in a module, its name is prefixed by the module name.