> //All variables are of type double. > long_diff = fabs(lon1_deg - lon2_deg)/2.0; //Absolute > value > cot1 = 1/(tan((long_diff)/90 * pi/2)); > > //cot1 value when I compile thro CW - > 1206.226660616226 > with long_diff value 0.04749999999999943 > > //Calculator gives me 69111.712627 which is correct > b'cos I get the correct distance using this value. > > Does anybody have any clue on this behaviour.
The formula is cot1 = cot(0.0475 * R), where R = pi/180 = 0.01745329. Using the approximation cot(x) ~ 1/x, we have cot1 ~ 1/(0.0475 * R) = 1206.227, which is what CW gives. Your calculator gives 69111.71 = 1206.227 / R ~ cot(0.475 * R * R). Somewhere you are confusing degrees with radians. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
