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
Steve Kargl wrote:
> 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.
We'll need this because we will want to model target arithmetic precisely,
including precision loss. Say for a contrived example, someone wants to
determine the exponent range and does something like
x = 1.5; y = 1.5; i = 1
DO WHILE (y==x)
y = x**(-i)
y = x**i
i = i + 1
END DO
! Precision loss occured, i is now abs(minexponent) + precision
! (possibly off-by-one)
then we want the compile-time operation to yield the same result (one could
for instance do this in an array constructor).
I have already sent an implementation of truncation to the list. (I actually
tried right and left shifting first via mpz_mul_2exp() first, but then found
out that this takes an unsigned shift value, and therefore only performs left
shifts :-/)
- Tobi