Function name : acos
Header file : <math.h>
Function prototype : double acos(double x);
Function : Find the number of radians whose cosine value is x
Parameters : double x cosine value. The value of x must be in the interval [-1, 1]. If the value of x exceeds this interval, a domain error will occur.
Return value : Under normal circumstances (the value of x is in the interval [-1, 1]), the function returns the number of radians of the angle whose cosine value is x. If the value of x is out of range, acos() will generate a domain error and the return value will be NaN (Not A Number).
Note : acos() knows the cosine value y of an angle and finds the radian value x of the angle.
Program example : Find the number of radians whose cosine value is x, convert the result into an angle, and output the result
#include<math.h>#include<stdio.h>#definePI3.14159265intmain(void){doubleresult;doublex=0.5;result=acos(x)*180/PI;printf(Thearccosineof%lfis%lfn,x ,result);return0;}
Running results:
Thearccosineof0.500000is60.000000