Mail Archives: djgpp/1992/08/24/20:03:19
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
- Raw text -