hypotd32()、hypotd64()、hypotd128() - 2 つの引数の二乗の平方根の計算

標準

標準/拡張機能 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); 
注 :
  1. これらの関数は、IEEE 10 進数浮動小数点形式で機能します。詳細は IEEE 10 進数浮動小数点を参照してください。
  2. IEEE 10 進数浮動小数点を使用するためには、ハードウェアに 10 進数浮動小数点機能 がインストールされている必要があります。

戻り値

正常に実行された場合、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);
}

関連情報