Problem with zeros.
Tobias Burnus
burnus@net-b.de
Thu Jul 19 18:04:00 GMT 2007
Steve Kargl wrote:
> libc on FreeBSD isn't glibc. It's probably an implementation
> detail of the scanf() family of functions
But not scanf directly as scanf("%f", float) produces "0.0" and "Inf" on
my system.
... ok, I did not check errno:
if (errno != 0 && errno != EINVAL)
{
generate_error (&dtp->common, ERROR_READ_VALUE,
"Range error during floating point read");
return 1;
}
This gives for the denormal numbers and too large numbers:
ERRNO = 34, error = Numerical result out of range
This is ERANGE. I wonder whether one should leave of this ERANGE change?
POSIX defines it as "Result too large."
Interestingly, looking at POSIX (or ISO C), for scanf ERANGE is not
listed as condition under which fscanf() functions fail and may fail.
These are only EILSEQ, EINVAL and the onces listed in fgetc/fgetwc.
Therefore, I would suggest to simply remove either the hole if block or
to exclude at least ERANGE.
Tobias
More information about the Fortran
mailing list