Date: Mon 24 Aug 92 19:26:35 From: ronis AT ronis DOT chem DOT mcgill DOT ca (David M. Ronis) To: djgpp AT sun DOT soe DOT clarkson DOT edu Cc: ronis AT ronis DOT chem DOT mcgill DOT ca Subject: Bug & fix in %g format Hi DJ, Here is the patch for the bug I reported with %g format. Recall that trying to print something like 1.000001 using %13.5g format resulted in 1.000001, not 1., (the latter I believe is correct). The problem is in the routine cvt in the file libsrc/c/io/doprnt.c. In short, the 0's between the two 1's were not counted as significant. If I call the fixed and original versions doprnt.new and doprnt.old, respectively. Here is the result of running diff doprnt.old doprnt.new ====================================================================== 601,603c601 < if (fract) { < if (prec) { < do { --- > while (prec && fract) { 606,609c604 < } while(!tmp); < while (--prec && fract) { < fract = modf(fract * 10, &tmp); < *t++ = tochar((int)tmp); --- > prec--; 611d605 < } 615d608 < } ====================================================================== David Ronis