Compiling a decimal floating-point program
If you are using decimal floating-point formats in your programs, use the -qdfp option and define the __STDC_WANT_DEC_FP__ macro when you compile them.
For example, to compile dfp_hello.c,
use the following compiler invocation:
xlc dfp_hello.c -qdfp -qarch=pwr7 -D__STDC_WANT_DEC_FP__
#include <stdio.h>
#include <float.h>
int main() {
printf("Hello DFP World\n");
printf("DEC32_MAX = %Hf\n",DEC32_MAX);
float f = 12.34df;
printf("12.34df as a float = %f\n",f);
}
Besides defining the __STDC_WANT_DEC_FP__ macro on the command line, you can also define this macro in your source files using the #define directive.