[gfortran] I/O of large integer and real kinds
Steve Kargl
sgk@troutmask.apl.washington.edu
Tue Jun 7 20:14:00 GMT 2005
On Tue, Jun 07, 2005 at 09:55:30PM +0200, FX Coudert wrote:
> >>+#if defined (HAVE_GFC_REAL_10) || defined (HAVE_GFC_REAL_16)
> >>+# if HAVE_LOG10L || HAVE_LOG10L_IN_LIBSUNMATH
> >>+ abslog = fabs(log10l (value));
> >
> >fabsl
>
> No need for that. fabsl is not available on some platforms, and the case
> where the exponent of a value does not fit into a double... well, let's
> say it won't occur often enough to justify the extra trouble.
D'oh! I'll reboot my brain in a moment.
> Perhaps it is better to write the case explicitly?
> abslog = fabs ((double) log10l (value));
This is how I would do it because otherwise you'll have
someone like me suggesting that fabsl is correct. :-)
> >Shouldn't this be someting like
> >
> >#if (HAVE_GFC_REAL_10 || HAVE_GFC_REAL_16)
> ># if HAVE_FINITEL
> > res = finitel (n);
> ># else
> > res = gfc_finitel (n); /* a builtin or we supply in c99_functions.c */
> ># endif
> >#else
>
> Yes, provided someone can write gfc_finitel in short time. Other than
> that, using isfinite (and the implicit cast to double if need be)
> provides a graceful degradation, I think.
>
Are you missing "defined" in the #if statement?
#if (defined (HAVE_GFC_REAL_10) || defined (HAVE_GFC_REAL_16))
&& defined (HAVE_FINITEL)
--
Steve
More information about the Fortran
mailing list