標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
C/C++ DFP | 両方 | z/OS® V1.8 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Bool samequantumd32(_Decimal32 x, _Decimal32 y);
_Bool samequantumd64(_Decimal64 x, _Decimal64 y);
_Bool samequantumd128(_Decimal128 x, _Decimal128 y);
samequantum 関数は、x および y の指数表記が同じかどうか判別します。x および y の両方とも NaN または無限大の場合、それらは同じ指数表記を持ちます。確実に 1 つのオペランドが無限大、または確実に 1 つのオペランドが NaN の場合、それらは同じ指数表記を持ちません。samequantum 関数は浮動小数点例外を起こしません。
引数 | 説明 |
---|---|
x | 最初の入力値 |
y | 2 番目の入力値 |
samequantum 関数は、x および y が同じ指数表記を持つ場合は「真」を戻し、そうでない場合は「偽」を戻します。
⁄* CELEBS72
This example illustrates the samequantumd64() function
*⁄
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
_Decimal64 a1 = strtod64("1.23" , NULL);
_Decimal64 a2 = strtod64("0.01" , NULL);
_Decimal64 b1 = strtod64("1.234" , NULL);
_Decimal64 b2 = strtod64("0.01" , NULL);
_Decimal64 c1 = strtod64("1.000" , NULL);
_Decimal64 c2 = strtod64("1.00" , NULL);
_Decimal64 d1 = strtod64("0.000" , NULL);
_Decimal64 d2 = strtod64("0.00" , NULL);
printf( "x=%-8.2DF y=%-8.2DF samequantum=%d¥n"
"x=%-8.3DF y=%-8.2DF samequantum=%d¥n"
"x=%-8.3DF y=%-8.2DF samequantum=%d¥n"
"x=%-8.3DF y=%-8.2DF samequantum=%d¥n"
, a1, a2, (int)samequantumd64(a1, a2)
, b1, b2, (int)samequantumd64(b1, b2)
, c1, c2, (int)samequantumd64(c1, c2)
, d1, d2, (int)samequantumd64(d1, d2)
);
return 0;
}