Subnormals and mpfr, was: Re: [gfortran] Fix NEAREST constant folder

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Wed Apr 13 16:32:00 GMT 2005


Steve Kargl wrote:
> After spending a few hours last night with mpfr, I've come
> to the conclusion that we don't need wrappers.  We need
> to change how we range check for underflow and we may
> need to change how we convert from an mpfr_t number to
> a number that is given to the backend.  Of course, I've
> also had a few exchanges with MPFR developers. :-)

I figured that wrappers might be an easier way to convince the rest of gcc to
move to mpfr, but apart from this hypothetical point I agree with you.  I
don't expect gcc to make a move in this direction before 4.2 unless we both
provide such a beautiful implementation of compile-time arithmetic that they
can't help loving it, and we import gmp and mpfr into the tree.  Maybe you can
convince the mpfr people to move to gcc's cvs (or svn, once that's in place) :-)

> For undeflow, we currently check against a Fortran model
> number where emin is determined by the kind type.  We need to
> permit gradual underflow by changing the check to a subnormal
> number determined from (emin - precision).  To accomplish this,
> I think we can add sub_exponent = min_exponent - precision
> to the gfc_real_info structure.  Note, sub_exponent may be off
> by 1.

The bit-width and the minimum exponent are already in the gfc_real_info
structure, so a new field isn't needed.  If there are targets which don't have
subnormals, we will need an additional field which tells if the target
actually supports subnormal numbers, though.

- Tobi



More information about the Gcc-patches mailing list