標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
C/C++ DFP |
両方 | z/OS® V1.10 |
#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 */
0 から pi の範囲のラジアンで表される、x の逆余弦を 計算します。
x の値は、-1 と 1 の間 (両端を含む) になければなりません。
これらの関数は、IEEE 10 進数浮動小数点形式で機能します。詳細は、IEEE 10 進数浮動小数点を参照してください。
正常終了した場合、関数は引数 x の逆余弦を戻します。
x が -1 よりも小さい、または 1 よりも大きい場合、関数は errno に EDOM を設定し、NaNQ を戻します。その他のエラーは発生しません。
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 );
}
}