acos, acosf, acosl, acosd32, acosd64, or acosd128 Subroutines

Purpose

Computes the inverse cosine of a given value.

Syntax

#include <math.h>

float acosf (x) 
float x;

long double acosl (x) 
long double x;

double acos (x)
double x;
_Decimal32 acosd32 (x)
_Decimal32 x;

_Decimal64 acosd64 (x)
_Decimal64 x;

_Decimal128 acosd128 (x)
_Decimal128 x;

Description

The acosf, acosl, acos, acosd32, acosd64, and acosd128 subroutines compute the principal value of the arc cosine of the x parameter. The value of x should be in the range [-1,1].

An application wishing to check for error situations should set the errno global variable to zero and call fetestexcept(FE_ALL_EXCEPT) before calling these functions. On return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

Item Description
x Specifies the value to be computed.

Return Values

Upon successful completion, these subroutines return the arc cosine of x, in the range [0, pi] radians.

For finite values of x not in the range [-1,1], a domain error occurs, and a NaN is returned.

If x is NaN, a NaN is returned.

If x is +1, 0 is returned.

If x is ±Inf, a domain error occurs, and a NaN is returned.