[Patch] libstdc++/9151

Paolo Carlini pcarlini@unitus.it
Mon Jan 6 13:19:00 GMT 2003


Hi,

the problem turns out to be due to a difference between %g and %e
which I had overlooked before. Consider:

#include <float.h>
#include <stdio.h>

int main()
{
  printf("%.3g\n", 2.34567e-20);
  printf("%.3e\n", 2.34567e-20);

  return 0;
}

The corresponding output is:

2.35e-20
2.346e-20

That is, for %g, 1 decimal digit less than the "expected" 3 after
the decimal point.

This implies that, in general, we need a __max_prec larger by 1.

Patch follows, tested x86-linux, as usual.

Ok everywhere?

////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_9151
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030106/2cf398cf/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_9151
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030106/2cf398cf/attachment-0001.ksh>


More information about the Libstdc++ mailing list