regression in list directed write
THOMAS Paul Richard
prthomas@drfccad.cea.fr
Fri Jan 14 07:44:00 GMT 2005
Please see below an off-list exchange between Steve Kargl and me on the
above.
isfinite(x) replaced finite(x) in one place in /libgfortran/io/write.c,
following a message from David Anglin, to the effect that finite(x) was not
available on his system. Unfortunately, isfinite(x) is broken in Cygwin,
whereas finite(x) is OK....
Other than the obvious(I will notify Cygwin), there are two solutions:
(i) Conditional compilation - which flag(s) to use? WIN32 ? __CYGWIN ? Are
these available outside of java or ada? Is this discouraged strongly?
(ii) sprintf("%4g",x) always does the right thing, as far as I know and the
following, rather revolting gfc_finite(x) works, wherever I have tried it;
even with the argument being float:
#include <stdio.h>
int
gfc_finite (double x)
{
char str[4];
sprintf (str, "%4g", x );
return strcmp ((char*)(str + 1), "Inf") ? 1 : 0;
}
Paul Thomas
-----Message d'origine-----
De : Steve Kargl
Envoyé : mercredi 12 janvier 2005 18:20
À : THOMAS Paul Richard
Objet : Re: regression in list directed write
On Wed, Jan 12, 2005 at 06:03:15PM +0100, THOMAS Paul Richard wrote:
> >Now, cygwin appears to have problems with isfinite() and
> >you suggested that we change it to finite(). Ping-pong.
>
> >AFAIK, the configure script only checks for the existence of
> >isfinite() function. It does not check if it works. Your
> >suggestion of using sprintf() and a check for Inf and NaN
> >is probably the best workaround.
>
> >Feel free to post the above to the gfortran mailing list,
> >if you want ti invoke additional comments.
>
> I'll post this discussion tomorrow. I am completely knackered after a day
> of smoothing the last wrinkles in NAMELIST read and write. I just got
there
> a few minutes ago.
Ah, namelist. Someday I may actually try to understand that feature
of Fortran.
> Surely there are some platform flags that we can conditionally compile by?
> If not, I will write a cheap, cheerful and very nasty gfc_finite()!
You'll need to ask on gcc@ on the right way to do platform
specific workarounds. I may be mistaken, but I think the
use of "#ifdef CYGWIN" (or similiar) is discouraged in the
source code. I wonder if there are macros such as ISFINITE()
that already workaround problems.
If you throw together a gfc_finite(), then it should go in
gcc/libgfortran/intrinsics/c99_functions.c :-)
--
Steve
More information about the Fortran
mailing list