same thing happened when I used nawk or gawk.
Is there a way to do this?
Melroy
Use mathematical identities such as:
(sin a)**2 + (cos a)**2 = 1
tan a = (sin a)/(cos a)
so with a value v that is the cosine of an angle a,
tan(a) = sin(a)/cos(a) = sqrt(1 - (v)*(v))/(v)
tan(a) = sqrt((1/(v*v)) - 1)
a = atan2(sqrt(1/(v*v)) -1)
you can so the same thing starting with sine instead of cosine
Make sure you don't divide by zero. :-)
Chuck Demas
--
Eat Healthy | _ _ | Nothing would be done at all,
Stay Fit | @ @ | If a man waited to do it so well,
Die Anyway | v | That no one could find fault with it.
de...@theworld.com | \___/ | http://world.std.com/~cpd
> do asin, acos exist in awk,gawk or nawk?
No. They are easily defined, however:
function asin(x) { return atan2(x, sqrt(1-x*x)) }
function acos(x) { return atan2(sqrt(1-x*x), x) }
function atan(x) { return atan2(x,1) }
Beware of rounding errors with arguments close to 1.
--
Tapani Tarvainen