acos - C math.h

C examples for math.h:acos

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Compute arc cosine of x, expressed in radians.

Prototype

long double acosl (long double x);
long double acos (long double x);
     double acos (double x);
      float acosf (float x);
      float acos (float x);
     double acos (T x);          

Parameters

Parameter Description
x Value whose arc cosine is computed, in the interval [-1,+1].

Return Value

Principal arc cosine of x, in the interval [0,pi] radians.

Example

Demo Code

#include <stdio.h>
#include <math.h>

#define PI 3.14159265//from  w  ww  .  j a  v a2  s  .  c o  m

int main ()
{
  double param = 0.5;
  double result = acos (param) * 180.0 / PI;
  printf ("The arc cosine of %f is %f degrees.\n", param, result);
  return 0;
}

Related Tutorials