HP aC++/HP C A.06.25 Release Notes

Table Of Contents
int r, s; // fread, scanf returns
_Binaryencoding64 be; // for binary-encoded (bid) input
_Decimalencoding64 de; // for decimal-encoded (dpd) input
// open input file
if (encoding == ascii)
inp = fopen(ifilename, "r");
else
inp = fopen(ifilename, "rb");
if (inp == NULL) {
fprintf(stderr, "FAILURE: could not open %s\n", ifilename);
exit(EXIT_FAILURE);
}
// open output file
outp = fopen(ofilename, "w");
if (outp == NULL) {
fprintf(stderr, "FAILURE: could not open %s\n", ofilename);
exit(EXIT_FAILURE);
}
// initialize sums
sumM = 0.DD;
sumH = 0.0DD;
sumB = 0.00DD;
// main loop
for (n=0; ; n++) {
// read a number
if (encoding == ascii) {
s = fscanf(inp, "%De", &m);
if (s == 0) {
fprintf(stderr, "FAILURE: on input from %s\n", ifilename);
fclose(inp);
fclose(outp);
exit(EXIT_FAILURE);
}
if (s == EOF) break;
}
else if (encoding == bid) {
r = (int) fread(&be, sizeof(_Binaryencoding64), 1, inp);
if (r != 1) break;
m = _decodebinary64(be); // decode bid
}
else /* encoding == dpd */ {
r = (int) fread(&de, sizeof(_Decimalencoding64), 1, inp);
if (r != 1) break;
m = _decodedecimal64(de); // decode dpd
}
// compute hours billed
fe_dec_setround(FE_DEC_UPWARD);
h = m / 60;
h = quantized64(h, onert); // round to tenths
// compute billing amount
fe_dec_setround(FE_DEC_TONEARESTFROMZERO);
New Features in Version A.06.20 23