Below is a version you might find less cryptic. It is from the url I cited
the other day. The asin() and acos() functions return void for invalid
inputs.
-- The inverse sine and cosine, known as the arcsine and arccosine
-- can be derived as follows. Note the special handling of the end conditions:
-- Note: In Director 6.0, "pi" didn't always work, and you can use "pi()"
instead to
-- obtain the value of pi. Or preferably upgrade to Director 6.0.2 or later
-- The result from asin() and acos() are in radians.
-- This utility converts radians to degrees.
on radiansToDegrees rads
return rads*180/pi
end
-- And here is how to use it:
-- put radiansToDegrees(asin(.5))
-- 30.0000
on asin x
-- Returns values between -pi/2 and pi/2
-- Input "x" must be between -1 and 1
if abs(x) > 1 then
return void
else if x = 1 then
return pi/2
else if x = -1 then
return -pi/2
else
return atan(float(x)/sqrt(1-x*x))
end if
end asin
on acos x
-- Returns values between 0 and pi
-- Input "x" must be between -1 and 1
if abs(x) > 1 then
return void
else
return pi/2-asin(x)
end if
end acos
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]