Log In  

Hi All,

Has anyone built up inverse-sine and inverse-cosine functions?

Right now, we have cos(x), sin(x), and atan2(dx,dy). If all else fails, I can create a table function to look these up, but figured I'd ask around to avoid duplicating the work.

-Electric Gryphon

P#19306 2016-03-19 14:58 ( Edited 2016-03-20 20:08)

2

Mathematically, I think the right answer is the following. But these do not check for out of range values or other possible error conditions. And they have the additonal problem that sqrt() is only a rough approximation.

function acos(x)
 return atan2(x,-sqrt(1-x*x))
end

function asin(y)
 return atan2(sqrt(1-y*y),-y)
end
P#19325 2016-03-20 16:08 ( Edited 2016-03-20 20:08)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 13:35:50 | 0.006s | Q:8