Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C/C++ DFP |
both | z/OS® V1.10 |
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal32 erfd32(_Decimal32 x);
_Decimal64 erfd64(_Decimal64 x);
_Decimal128 erfd128(_Decimal128 x);
_Decimal32 erf(_Decimal32 x); /* C++ only */
_Decimal64 erf(_Decimal64 x); /* C++ only */
_Decimal128 erf(_Decimal128 x); /* C++ only */
_Decimal32 erfcd32(_Decimal32 x);
_Decimal64 erfcd64(_Decimal64 x);
_Decimal128 erfcd128(_Decimal128 x);
_Decimal32 erfc(_Decimal32 x); /* C++ only */
_Decimal64 erfc(_Decimal64 x); /* C++ only */
_Decimal128 erfc(_Decimal128 x); /* C++ only */
Because the erfc() function calculates the value of 1.0 - erf(x), it is used in place of erf() for large values of x.
These functions work in IEEE decimal floating-point format. See IEEE decimal floating-point for more information.
erf() and erfc() are always successful.
CELEBE12
⁄* CELEBE12
This example illustrates the erfd32() and erfcd32() functions.
*⁄
#define __STDC_WANT_DEC_FP__
#include <stdio.h>
#include <math.h>
_Decimal32 smallx, largex, value;
int main(void)
{
smallx = 0.1DF;
largex = 10.0DF;
value = erfd32(smallx);
printf("Error value for 0.1: %Hf\n", value);
value = erfcd32(largex);
printf("Error value for 10.0: %He\n", value);
}