This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/gfortran] Fix handling of subnormal numbers
On Thu, Apr 14, 2005 at 12:23:38PM +0200, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> > 2005-04-13 Steven G. Kargl <kargls@comcast.net>
> >
> > * gfortran.h (gfc_real_info): Add subnormal struct member.
> > * arith.c (gfc_arith_init_1): Set it.
> > (gfc_check_real_range): Use it.
> > * simplify.c (gfc_simplify_nearest): Fix nearest(0.,1.).
> >
> > 2005-04-13 Steven G. Kargl <kargls@comcast.net>
> >
> > * gfortran.dg/underflow.f90: Use tiny(x)/huge(x).
>
> This is ok. Do you plan to implement the truncating rth suggested? Another
> thing that has crossed my mind with regard to what we may need from the FP
> library, is a way to convert between mpfr_t and the target's binary
> representation. This would be required to implement hollerith constants, at
> least if we want to be evaluate expressions involving them during constant
> folding.
I'm not sure that rth's truncation is needed. My impression from
a few email exchanges with mpfr developers suggests that mpfr
does the right thing as long as we don't muck with setting the
exponential range. On the other hand, forcing the unused bits
to zero, can't hurt. I'll need to look at the mpfr_t struct
and see how the numbers are represented. mpfr_t contains an
array of GMP limbs. We should be able to do a right shift
then left shift to clear the bits.
--
Steve