cosd32(), cosd64(), cosd128() — Calculate cosine

Standards

Standards / Extensions C or C++ Dependencies
C/C++ DFP both z/OS® V1.8

Format

#define __STDC_WANT_DEC_FP__
#include <math.h> 

_Decimal32  cosd32(_Decimal32 x); 
_Decimal64  cosd64(_Decimal64 x);
_Decimal128 cosd128(_Decimal128 x);

_Decimal32  cos(_Decimal32 x);  /* C++ only */
_Decimal64  cos(_Decimal64 x);  /* C++ only */
_Decimal128 cos(_Decimal128 x); /* C++ only */

General description

Calculates the cosine of x. The value x is expressed in radians.
Notes:
  1. To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.
  2. These functions work in IEEE decimal floating-point format. See "IEEE Decimal Floating-Point" for more information.

Returned value

Returns the calculated value.

If x is outside prescribed limits, the value is not calculated. Instead, the function returns 0 and sets errno to EDOM.

Example

/* CELEBC48

   This example illustrates the cosd128() function.

*/

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

int main(void)
{
   _Decimal128 x, y;

   x = 7.2DL;
   y = cosd128(x);

   printf("cosd128(%DDf) = %DDf\n", x, y);
}

Related information