May I use math functions like atan, atan2, sin, cos, acos in

Posted by Admin on 11-Oct-2006 11:31

I need to do a program for calculate distance between two lat/long points, but the formula uses math functions. Anybody know how can I do?

Thanks

All Replies

Posted by Alon Blich on 11-Oct-2006 12:17

http://www.peg.com/utilities.html

Posted by vimburgi on 05-Dec-2006 09:08

Sorry to say buth the math.i you refer are quite bad. Implementation is wrong (from a MATH point of view) for many of the functions: SIN, COS, ATAN and ASIN .

Just to confirm this try to run:

DEFINE VARIABLE i AS DECIMAL NO-UNDO.

DEFINE VARIABLE c AS CHARACTER NO-UNDO.

DEFINE VARIABLE si AS DECIMAL NO-UNDO.

DEFINE VARIABLE co AS DECIMAL NO-UNDO.

i = -180.

DO WHILE i

si = DYNAMIC-FUNCTION('sin':U, i).

co = DYNAMIC-FUNCTION('cos':U, i).

c = c + chr(10) + string(i) + ' ' +

STRING(co) + ' ' + STRING(si) + ' ' + STRING(si * si + co * co) .

i = i + 1.

END.

CLIPBOARD:VALUE = c.

This thread is closed