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] Fix NEAREST constant folder


On Wed, Apr 13, 2005 at 12:33:38PM +0200, Tobias Schl?ter wrote:
> Richard Henderson wrote:
> > On Tue, Apr 12, 2005 at 01:56:51PM -0700, Steve Kargl wrote:
> > 
> >>I suspect we will need to rip MPFR out of gfortran, and
> >>use gcc/real.c.
> > 
> > I'm not thrilled about this, since there had been a vague push
> > to move real.c to use MPFR as well.  What about creating some
> > wrapper functions that allow us to fake subnormal numbers?
> 
> Here's a very first go at such a wrapper.  This is just a simple
> self-contained program which outlines the possible interface, and I don't
> think it will look much like this on inclusion, but I have a few questions and
> thought it would be better to accompany them with some code (even if its debug
> messages are in German and it may be off-by-one or contain similar bugs):
> 

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. :-)

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.

-- 
Steve


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