This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: HUGE() pain in the ...


On Sun, Jul 18, 2004 at 02:20:01PM +0200, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> > 
> > Well, I now know what the problem is.  The MPFR function
> > 
> >     p = mpfr_get_str (NULL, &exp, 10, 0, f, GFC_RND_MODE);
> > 
> > in gfc_conv_mpfr_to_tree() will return "the maximum possible number
> > of digits giving an exact rounding in the given base BASE with the
> > direction RND".  For BASE=10 and round to nearest, the maximum number
> > of decimal digits for REAL(4) and REAL(8) are 6 and 15.
> > 
> How about using a base 16 string? real_from_string2 supports those as well.
> 

This would necessitate a complete rewite of gfc_conv_mpfr_to_tree().
For example, the mpfr representation of the number -1.123 will be give
p = -112300000000000    exp=1  (base 10)
p = 11f7ced916873       exp=1  (base 16)
gfc_conv_mpfr_to_tree() takes p and exp to generate -.1123e1.  It is
not at all clear to me (based on the lack of documentation in real.c)
what the proper form of the hex string is.  In particular,
p = 11f7ced916873 is the hex representation of the 53-bit significand.
Do we assign p to a 64 bit integer, left shift by 11 bits, set
the lower 11 bits to a biased exponent, and then convert the 64-bit
into a hex representation?

-- 
Steve


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