[PATCH] Remove GMP in favor of MPFR

Paul Brook paul@codesourcery.com
Sun Jul 4 16:17:00 GMT 2004


> > +/* Andy may have used biased exponents e = E + bias where bias = 1.
> > +   Single precision model numbers.  */
> >
> > I don't understand this comment, and the following defines are
> > inconsistent (some differ by one, others are the same).
> >
> > Is this a genuine error, or the difference between defining the valid
> > exponents as <= E vs. < E ?
>
> I'm looking at the July 1, 2004 revision of the IEEE-754 standard.
> Table 1a shows
>             p    emax   emin
> binary32    24    127   -126
> binary64    53   1023  -1022
> binary128  113  16383 -16382
>
> If you go to www.mpfr.org, and then go to the bottom of that
> page, you'll find a link to the IEEE 754 working group.  You
> can find PDFs of the current standard and the current proposed
> revision.  Of course, these PDFs are to be used in contributing
> comments to the IEEE 754 working group.
>
> I've retained the original emin and emax for single (128,-125)
> and double (1024,-1021) precision because I wasn't sure if the
> computations of range, precision, epsilon, huge, and tiny depend
> on these values in some unusual way.  This is on my list of
> things to check against the draft F2003 standard.

I think these numbers come from gcc/real.c. However reading a bit further 
uncovers the following comment:
      /* Recall that IEEE numbers are interpreted as 1.F x 2**exp,
         whereas the intermediate representation is 0.F x 2**exp.
         Which means we're off by one.  */

There's also Note 13.4 from the standard, which looks a lot like ieee single 
precision format.

Based on this I think the correct values are 127, -126 and 1023, -1022.

Ideally we would generate these tables automatically for different targets, 
but that's a different matter.

Paul



More information about the Fortran mailing list