This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Problem with zeros.
- From: Tobias Burnus <burnus at net-b dot de>
- To: edepagne at lcogt dot net
- Cc: fortran at gcc dot gnu dot org
- Date: Thu, 19 Jul 2007 19:12:48 +0200
- Subject: Re: Problem with zeros.
- References: <200707190937.38511.edepagne@lcogt.net>
Hi,
Éric Depagne wrote:
> My code reads a file, and puts the content of this file into an array.
> The array is defined like this:
>
> DIMENSION X(40,30)
> The content of the file looks like this:
> 9.999e-46 9.999e-46 9.999e-46 9.999e-46 9.999e-46 2.944E-19
>
Which gives the run-time error:
At line 2 of file xxx.f90 (unit = 5, file = 'stdin')
Fortran runtime error: Range error during floating point read
> I would like to know if there is a way to let gfortran know that when he
> encounters values that are too small, he shall convert them to zero ?
>
To my knowledge not.
I played around with other compiles and:
a) 9.999e-46
1. ifort, NAG f95, sunf95, pgf95: denormalized number: 1.4012985E-45
2. g95, openf95: 0.0
3. gfortran: Range error
(gcc+glibc with scanf: (2).)
b) 1e99
1. sunf95, g95, f95, openf95, pgf95: Inf
2. ifort, gfortran: Range error
(gcc+glibc with scanf: (1).)
For (a) I think (1) is the best result and (2) is also ok. I don't see
any good reason to do (3).
For (b) one can argue whether (1) or (2) is better; I like (1) more, one
might argue that (2) has also its merits and one may argue for an
option, but overflow FP traps would have the same result, I'd guess.
(Assuming that the data is used later on.)
What do the others think?
Tobias