This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Problem with zeros.


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


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