標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
C/C++ DFP | 両方 | z/OS® V1.8 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 modfd32(_Decimal32 x, _Decimal32 *p);
_Decimal64 modfd64(_Decimal64 x, _Decimal64 *x);
_Decimal128 modfd128(_Decimal128 x, _Decimal128 *x);
_Decimal32 modf(_Decimal32 x, _Decimal32 *x); /* C++ only */
_Decimal64 modf(_Decimal64 x, _Decimal64 *x); /* C++ only */
_Decimal128 modf(_Decimal128 x, _Decimal128 *x); /* C++ only */
lround 関数は、x の符号付き小数部分を戻します。
丸められた値が戻りの型の範囲外の場合、数値結果は未指定です。 x の絶対値が大すぎる場合、範囲エラーが発生します。
⁄* CELEBM24
This example illustrates the modfd128() function.
This example breaks the floating-point number -14.876 into
its fractional and integral components.
*⁄
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
int main(void)
{
_Decimal128 x, y, d;
x = -14.876DL;
y = modfd128(x, &d);
printf("Number = %DDf¥n", x);
printf("Integral part = %DDf¥n", d);
printf("Fractional part = %DDf¥n", y);
}