This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] commited, patch for PR 24685


On Wed, Feb 15, 2006 at 10:37:30AM +0100, Fran?ois-Xavier Coudert wrote:
> > Could you run the same testcase with a
> > "write(*,fmt='(F70.40)') b" line added?
> 
> Sorry, I messed up. I meant " fmt='(E70.40)' " That would show that
> the problem is really in the default format being not wide enough.

fmt='(E70.40E4)' isn't enough either, with that I'm getting
                      0.1189731495357231765085800000000000000000E+4933
                      0.1189731495357231765085800000000000000000E+4933
which is still rounded.
Seems output_float has many hardcoded limits, including char buffer[32],
and many of those limits are insufficient for both IEEE quad long double
and IBM extended long double.
E.g. IEEE quad __LDBL_DIG__ is 33, so you need at least 33 decimal
digits after decimal point.
  /* Use sprintf to print the number in the format +D.DDDDe+ddd
     For an N digit exponent, this gives us (32-6)-N digits after the
     decimal point, plus another one before the decimal point.  */
IEEE quad numbers are +D.DDDDe+dddd (up to 4 digits exponent), so
so 32 in output_float needs to be replaced by at least 43 or 44,
27 by 38 or 39, 31 by 42 or 43.
Also, probably:
      if (f->u.real.e < 0)
        {
          /* Width not specified.  Must be no more than 3 digits.  */
          if (e > 999 || e < -999)
            edigits = -1;
          else
            {
              edigits = 4;
              if (e > 99 || e < -99)
                expchar = ' ';
            }
        }
needs to be adjusted, as REAL*16 exponents can be +=5000 or so.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]