標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
C/C++ DFP | 両方 | z/OS® V1.11 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 hypotd32(_Decimal32 x, _Decimal32 y);
_Decimal64 hypotd64(_Decimal64 x, _Decimal64 y);
_Decimal128 hypotd128(_Decimal128 x, _Decimal128 y);
_Decimal32 hypot(_Decimal32 x, _Decimal32 y); /* C++ only */
_Decimal64 hypot(_Decimal64 x, _Decimal64 y); /* C++ only */
_Decimal128 hypot(_Decimal128 x, _Decimal128 y); /* C++ only */
hypot() ファミリーの関数は、2 つの辺 x および y の長さに基づいて、直角三角形の斜辺の長さを計算します。hypot() の呼び出しは次の式と同じです。
sqrt(x* x + y * y);
正常に実行された場合、hypot() ファミリーの関数は、計算された斜辺の長さを戻します。
正しい値がオーバーフローすると、hypot() は errno を ERANGE に設定し、HUGE_VAL_D32、HUGE_VAL_D64、または HUGE_VAL_D128 を適宜戻します。
⁄* CELEBH03
This example illustrates the hypotd64() function.
*⁄
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
void main(void)
{
_Decimal64 x, y, z;
x = 3.0DD;
y = 4.0DD;
z = hypotd64(x,y);
printf("The hypotenuse of a triangle with sides %Df and %Df"
" is %Df¥n", x, y, z);
}