標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
C/C++ DFP | 両方 | z/OS® V1.8 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 logbd32(_Decimal32 x);
_Decimal64 logbd64(_Decimal64 x);
_Decimal128 logbd128(_Decimal128 x);
_Decimal32 logb(_Decimal32 x); /* C++ only */
_Decimal64 logb(_Decimal64 x); /* C++ only */
_Decimal128 logb(_Decimal128 x); /* C++ only */
正常に実行された場合、これらの関数は x の非バイアス化した指数を 10 進数浮動小数点モードの符号付き整数値として戻します。
これらの関数は、以下の条件で失敗します。 x が 0.0 と等しい場合、-HUGE_VAL_D32、-HUGE_VAL_D64、または -HUGE_VAL_D128 が戻され、errno に EDOM を設定します。
⁄* CELEBL24
This program illustrates the use of logbd32() function
*⁄
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
_Decimal32 x, logbx;
printf("Illustrates the logbd32() function¥n");
⁄* Generate the smallest possible positive _Decimal32 number *⁄
x = strtod32("0000001.E-101", NULL);
logbx = logbd32(x);
printf("x = %Hg¥n" , x );
printf("logb(x) = %Hf¥n¥n", logbx);
printf("powd32(10.0, logb32(x)) should equal x¥n");
printf("powd32(%Hf, %Hf) = %Hg¥n",
10.0DF, logbx, powd32(10.0DF, logbx));
}