This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] I/O of large integer and real kinds, round 2
- From: François-Xavier Coudert <fxcoudert at gmail dot com>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: gfortran <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 23 Jun 2005 10:19:02 +0200
- Subject: Re: [gfortran] I/O of large integer and real kinds, round 2
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DcXz88gM2qks/ivVXhXk2V1QSpbYfUHCQlL0NRLyNEOUa/H7v3DpYTte0ZOQnSeB5+J/91lYKhcCYyhsfm6C++tzPD5gus6s16gzXz/iUFzWUFB/WeVqHCLdqTquLzZ7ixFncruUwEJNptDevgU0TasHcPJIP8zMOgBbL0xZVPo=
- References: <42A4C151.3000303@gmail.com> <42A7596E.4000704@gmail.com> <42A7761C.2050407@gmail.com> <20050621231636.GA3049@troutmask.apl.washington.edu>
- Reply-to: François-Xavier Coudert <fxcoudert at gmail dot com>
> FX, I think that this patch is ok with the exception of your implementation of log10l().
Well, rth's implementation in fact, but I agree with you.
> I don't understand how
> your regression tests where able to pass when there is
> no provision for small numbers. In particular, tiny(1._10)
> is something like 3e-4391. The current implementation of
> of log10l() will call log10() with 3e-4391. On FreeBSD,
> this isn't a Good Thing.
I did not understant it at first, but my test passed because I don't
have access to a computer where (LDBL_MAX_EXP > DBL_MAX_EXP) and
there's no system log10l. x86_64-freebsd is one of those.
+ if (x < DBL_MIN)
+ {
+ double val;
+ int p2_result = 0;
+ if (x < 0x1p-16380L) { p2_result += 16380; x /= 0x1p-16380L; }
+ if (x < 0x1p-8189L) { p2_result += 8189; x /= 0x1p-8189L; }
+ if (x < 0x1p-4093L) { p2_result += 4093; x /= 0x1p-4093L; }
+ if (x < 0x1p-2045L) { p2_result += 2045; x /= 0x1p-2045L; }
+ if (x < 0x1p-1021L) { p2_result += 1021; x /= 0x1p-1021L; }
+ val = abs(log10 ((double) x));
val = fabs (log10 ((double) x));
+ return (val + p2_result * .30102999566398119521373889472449302L);
return (- val - p2_result * .30102999566398119521373889472449302L);
I don't know why your compiler didn't see the abs/fabs problem (maybe
freebsd provides something with that name). As for the second one, it
doesn't affect current code (since the result from log10l is always
followed by a call to fabs()), but in the future people might rely on
log10l actually returning the logarithm itself.
> I've attached an alternative implementation of log10l()
> that permits amd64-*-freebsd to pass the regression tests.
Fine. I'll come up with a final version of the patch, which I will
regtest on all platforms available to me (sparc-solaris, i686-linux,
i386-freebsd, x86_64-linux). Will you make a last regtest on
amd64-freebsd?
Thanks for your help,
FX