Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C/C++ DFP | both | z/OS® V1.8 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 logd32(_Decimal32 x);
_Decimal64 logd64(_Decimal64 x);
_Decimal128 logd128(_Decimal128 x);
_Decimal32 log(_Decimal32 x); /* C++ only */
_Decimal64 log(_Decimal64 x); /* C++ only */
_Decimal128 log(_Decimal128 x); /* C++ only */
If x greater than 0, the function returns the natural logarithm (base e) of x.
If x is negative, the function sets errno to EDOM and returns NaNQ.
If x is 0.0, the function returns -HUGE_VAL_D32, -HUGE_VAL_D64, or -HUGE_VAL_D128 and errno remains unchanged.
⁄* CELEBL22
This example illustrates the logd64() function.
*⁄
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
int main(void)
{
_Decimal64 x = 1000.0DD, y;
y = logd64(x);
printf("The natural logarithm of %Df is %Df\n", x, y);
}