HP aC++/HP C A.06.20 Release Notes
option does not affect the precision of parameters, return types, or assignments.
The default is -fpevaldec=_Decimal32.
• Type-generic functions in <tgmath.h> that take on the type of decimal FP (or
binary FP) arguments.
• Our Decimal FP support incorporates code from the Intel Decimal Floating-Point
Math Library.
To use decimal FP:
• Install the following on an HP-UX 11i V3 (11.31) Integrity system:
— core Math patch PHSS_38137
— math manpage patch PHCO_38388
— libc patch PHCO_38048
— libcEnhancement package (http://docs.hp.com/en/5992-3373/ch10s12.html)
— libc man page patch PHCO_37128 (for printf and scanf man pages)
• To use any decimal FP functionality (even built-in operators), add the +decfp
option to the compile and link lines.
• To use the decimal FP functionality in <math.h>, <float.h>, <fenv.h>, or
<tgmath.h>, define __STDC_WANT_DEC_FP__ before including the header.
• To use strtod32, strtod64, or strtod128, include <strtodec.h>. (These
interfaces are not declared in <stdlib.h>, as specified in the ISO/IEC C draft
Technical Report.)
• Also see the “HP-UX floating-point guide for HP Integrity servers” at http://
www.hp.com/go/fp.
Decimal Floating-Point Example
/***********************************************************************
*
* This program is intended to illustrate how C decimal FP might be
* used in a commercial billing program.
*
* The program reads input data from a file, interprets each datum
* as a number of service minutes, converts to hours (rounding up to
* the nearest tenth of an hour), and multiplies by a billing rate
* (rounding to the nearest cent with halfway cases rounding away
* from zero). For each inputl, the program writes the billing amount
* as an ASCII character string to a file. Along the way, it
* accumulates sums of service minutes, hours billed, and amounts
* billed, and at the end writes the total sums to stdout.
*
* Program constants determine the input and output filenames and
* whether the input is ASCII, BID ("binary" encoding for decimal FP),
* or DPD ("decimal" encoding for decimal FP). The HP-UX
* implementation uses BID encoding for its decimal FP types.
*
**********************************************************************/
const char * ifilename = "biller.in"; // input file
New Features in Version A.06.20 11