acos, acosl

From RAD Studio
Jump to: navigation, search

Go Up to math.h Index


Header File

math.h

Category

Math Routines

Prototype

double acos(double x);
long double acosl(long double x);

Description

Calculates the arc cosine.

acos returns the arc cosine of the input value.

acosl is the long double version; it takes a long double argument and returns a long double result.

Arguments to acos and acosl must be in the range -1 to 1, or else acos and acosl return NAN and set the global variable errno to:

EDOM Domain error

Return Value

acos and acosl of an argument between -1 and +1 return a value in the range 0 to pi. Error handling for these routines can be modified through the functions _matherr_matherr and _matherrl.

Example

#include <stdio.h>
#include <math.h>
int main(void)
{
  double result;
  double x = 0.5;
  result = acos(x);
  printf("The arc cosine of %lf is %lf\n", x, result);
  return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

acos

+

+

+

+

acosl

+

+

+