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] I/O of large integer and real kinds, round 2


> 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


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