Monday, July 27, 2009

Does this line of code make sense (in c language)?

Does this look correct?





theta=acos(S/sqrt(Q*Q*Q));





Can you use Acos for inverse cos? ( in the programming language C)

Does this line of code make sense (in c language)?
The acos function computes the principal value of the arc cosine of x in the range [0, \pi]. acosl is a long double verion; it takes a long double argument and returns a long double result.





The arc cosine is the inverse cosine, usually donated as cos^{-1}(x). It is a multi valued functions of the following form:





#include %26lt;math.h%26gt;


double acos (double x)


long acosl (long double x)


float acosf (float x)











Example:





#include %26lt;stdio.h%26gt;


#include %26lt;math.h%26gt;





int main(void)


{


double result, x=0.5


result = acos(x);


printf("The arc cosine of %lf is %lf\n", x, result);


return 0;


}





Special Values


acos ( 1 ) returns +0.





acos ( x ) returns a NAN and raises the invalid floating-point exception for |x| %26gt; 1.








hope this will help


Cheers:)
Reply:Yes, you can, but you'll have to include the proper header, first.


No comments:

Post a Comment