acosd32(), acosd64(), acosd128() - Calculate arccosine
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C/C++ DFP |
both | z/OS® V1.10 |
Format
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 acosd32(_Decimal32 x);
_Decimal64 acosd64(_Decimal64 x);
_Decimal128 acosd128(_Decimal128 x);
_Decimal32 acos(_Decimal32 x); /* C++ only */
_Decimal64 acos(_Decimal64 x); /* C++ only */
_Decimal128 acos(_Decimal128 x); /* C++ only */
General description
Calculates the arccosine of x, expressed in radians, in the range 0 to pi.
The value of x must be between -1 and 1 inclusive.
These functions work in IEEE decimal floating-point format. See IEEE decimal floating-point for more information.
Note: To
use IEEE decimal floating-point, the hardware must have the Decimal
Floating-Point Facility installed.
Returned value
If successful, the function returns the arccosine of the argument x.
If x is less than -1 or greater than 1, the function sets errno to EDOM and returns NaNQ. No other errors will occur.
Example
CELEBA11
/* CELEBA11
The example illustrates the acosd32() function.
This example prompts for a value for x.
It prints an error message if x is greater than 1 or
less than -1; otherwise, it assigns the arccosine of
x to y.
*/
#define __STDC_WANT_DEC_FP__
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX 1.0DF
#define MIN -1.0DF
int main(void)
{
_Decimal32 x, y;
printf( "Enter x\n" );
scanf( "%Hf", &x );
/* Output error if not in range */
if ( x > MAX )
printf( "Error: %f too large for acosd32\n", x );
else if ( x < MIN )
printf( "Error: %f too small for acosd32\n", x );
else {
y = acosd32( x );
printf( "acosd32( %Hf ) = %Hf\n", x, y );
}
}
Related information
- math.h
- acoshd32(), acoshd64(), acoshd128() - Calculate hyperbolic arccosine
- asind32(), asind64(), asind128() - Calculate arcsine
- asinhd32(), asinhd64(), asinhd128() - Calculate hyperbolic arcsine
- atand32(), atand64(), atand128(), atan2d32(), atan2d64(), atan2d128() - Calculate arctangent
- atanhd32(), atanhd64(), atanhd128() - Calculate hyperbolic arctangent
- cosd32(), cosd64(), cosd128() — Calculate cosine
- coshd32(), coshd64(), coshd128() - Calculate hyperbolic cosine
- sind32(), sind64(), sind128() — Calculate sine
- sinhd32(), sinhd64(), sinhd128() - Calculate hyperbolic sine
- tand32(), tand64(), tand128() - Calculate tangent
- tanhd32(), tanhd64(), tanhd128() - Calculate hyperbolic tangent