Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C/C++ DFP | both | z/OS® V1.8 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 ldexpd32(_Decimal32 x, int exp);
_Decimal64 ldexpd64(_Decimal64 x, int exp);
_Decimal128 ldexpd128(_Decimal128 x, int exp);
_Decimal32 ldexp(_Decimal32 x, int exp); /* C++ only */
_Decimal64 ldexp(_Decimal64 x, int exp); /* C++ only */
_Decimal128 ldexp(_Decimal128 x, int exp); /* C++ only */
Returns the calculated value.
Otherwise, if the correct calculated value is outside the range of representable values, ±HUGE_VAL_D32, ±HUGE_VAL_D64, or ±HUGE_VAL_D128 is returned, according to the sign of the value. The value ERANGE is stored in errno to indicate that the result was out of range.
⁄* CELEBL19
This example illustrates the ldexpd32() function.
This example computes y = 1.5*10**5
*⁄
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
int main(void)
{
_Decimal32 x, y;
int p;
x = 1.5DF;
p = 5;
y = ldexpd32(x, p);
printf("%Hf times 10 to the power of %d is %Hf\n", x, p, y);
}