Hi all,

I am having trouble getting around the integer math limitations of the BS2, but I know there are ways to do so. I was hoping someone (with a
lot more BS2 experience than me) can take a look at the C code below
and suggest modifications that would yield the same result in Basic (or
something close as I know there will be rounding errors). The values I
get when compiling the code below are: distance!44 and anglef. I
really appreciate everyone's time!!!

Thanks in advance!

// declare variables float degrees_LAT1, minutes_LAT1, seconds_LAT1, degrees_LONG1, minutes_LONG1, seconds_LONG1; float degrees_LAT2, minutes_LAT2, seconds_LAT2, degrees_LONG2, minutes_LONG2, seconds_LONG2; float LAT_1, LAT_2, LONG_1, LONG_2; float D=0, courseAngle=0;

// initialize variables degrees_LAT1 = 33.0; minutes_LAT1 = 57.0; seconds_LAT1 = 30.0; degrees_LONG1 = 118.0; minutes_LONG1 = 24.0; seconds_LONG1 = 50.0; degrees_LAT2 = 40.0; minutes_LAT2 = 38.0; seconds_LAT2 = 55.0; degrees_LONG2 = 73.0; minutes_LONG2 = 47.0; seconds_LONG2 = 35.0;

// code that needs to be converted to basic for use with BS2... LAT_1 = (degrees_LAT1 + minutes_LAT1/60 + seconds_LAT1/3600) * (Pi/180); LONG_1 = (degrees_LONG1 + minutes_LONG1/60 + seconds_LONG1/3600) * (Pi/180); LAT_2 = (degrees_LAT2 + minutes_LAT2/60 + seconds_LAT2/3600) * (Pi/180); LONG_2 = (degrees_LONG2 + minutes_LONG2/60 + seconds_LONG2/3600) * (Pi/180);

D = acos(sin(LAT_1)

I am having trouble getting around the integer math limitations of the BS2, but I know there are ways to do so. I was hoping someone (with a

Thanks in advance!

// declare variables float degrees_LAT1, minutes_LAT1, seconds_LAT1, degrees_LONG1, minutes_LONG1, seconds_LONG1; float degrees_LAT2, minutes_LAT2, seconds_LAT2, degrees_LONG2, minutes_LONG2, seconds_LONG2; float LAT_1, LAT_2, LONG_1, LONG_2; float D=0, courseAngle=0;

// initialize variables degrees_LAT1 = 33.0; minutes_LAT1 = 57.0; seconds_LAT1 = 30.0; degrees_LONG1 = 118.0; minutes_LONG1 = 24.0; seconds_LONG1 = 50.0; degrees_LAT2 = 40.0; minutes_LAT2 = 38.0; seconds_LAT2 = 55.0; degrees_LONG2 = 73.0; minutes_LONG2 = 47.0; seconds_LONG2 = 35.0;

// code that needs to be converted to basic for use with BS2... LAT_1 = (degrees_LAT1 + minutes_LAT1/60 + seconds_LAT1/3600) * (Pi/180); LONG_1 = (degrees_LONG1 + minutes_LONG1/60 + seconds_LONG1/3600) * (Pi/180); LAT_2 = (degrees_LAT2 + minutes_LAT2/60 + seconds_LAT2/3600) * (Pi/180); LONG_2 = (degrees_LONG2 + minutes_LONG2/60 + seconds_LONG2/3600) * (Pi/180);

D = acos(sin(LAT_1)

***sin(LAT_2) + cos(LAT_1)***cos(LAT_2)***cos(LONG_1-LONG_2)); courseAngle = acos((sin(LAT_2)-sin(LAT_1)***cos(D))/(sin(D)***cos(LAT_1))); D = D***60*180/Pi; printf("distance = %f\n", D); printf("angle = %f\n\n", courseAngle*180/Pi);