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)

:: RGB

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))

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

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-10-25 20:28 | 0.008s | 4194k | Q:11