Mail Archives: djgpp/1998/03/03/11:45:28
>Thanks. But could you please generate the patch with "diff -c3"? It
>makes the patch process much more reliable.
*** doprnt.25x Sat Sep 14 02:20:28 1996
--- doprnt.c Fri Feb 27 11:10:26 1998
***************
*** 477,482 ****
--- 477,484 ----
long double fract;
int dotrim, expcnt, gformat;
long double integer, tmp;
+ int doextradps=0; /* Do extra decimal places if the precision
needs it */
+ int doingzero=0; /* We're displaying 0.0 */
if ((expcnt = isspeciall(number, startp)))
return(expcnt);
***************
*** 524,529 ****
--- 526,538 ----
}
number = integer;
fract = modfl(number, &integer);
+ /* If integer is zero then we need to look at where the sig figs are
*/
+ if (integer<1) {
+ /* If fract is zero the zero before the decimal point is a sig
fig */
+ if (fract==0.0) doingzero=1;
+ /* If fract is non-zero all sig figs are in fractional part */
+ else doextradps=1;
+ }
/*
* get integer portion of number; put into the end of the buffer;
the
* .01 is added for modf(356.0 / 10, &integer) returning
.59999999...
***************
*** 660,668 ****
break;
case 'g':
case 'G':
! /* a precision of 0 is treated as a precision of 1. */
! if (!prec)
! ++prec;
/*
* ``The style used depends on the value converted; style e
* will be used only if the exponent resulting from the
--- 669,683 ----
break;
case 'g':
case 'G':
! if (prec) {
! /* If doing zero and precision is greater than 0 count the
! * 0 before the decimal place */
! if (doingzero) --prec;
! }
! else {
! /* a precision of 0 is treated as precision of 1 unless doing
zero */
! if (!doingzero) ++prec;
! }
/*
* ``The style used depends on the value converted; style e
* will be used only if the exponent resulting from the
***************
*** 707,713 ****
{
fract = modfl(fract * 10.0L, &tmp);
*t++ = tochar((int)tmp);
! prec--;
}
if (fract)
startp = roundl(fract, (int *)NULL, startp, t - 1,
--- 722,734 ----
{
fract = modfl(fract * 10.0L, &tmp);
*t++ = tochar((int)tmp);
! /* If we're not adding 0s
! * or we are but they're sig figs:
! * decrement the precision */
! if ((doextradps!=1) || ((int)tmp!=0)) {
! doextradps=0;
! prec--;
! }
}
if (fract)
startp = roundl(fract, (int *)NULL, startp, t - 1,
- Raw text -