This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Possible explaination why large_real_kind_form_io_2.f90 is failing on PPC/OSX
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: fortran at gcc dot gnu dot org
- Date: Sun, 14 Jan 2007 20:32:46 +0100 (CET)
- Subject: Re: Possible explaination why large_real_kind_form_io_2.f90 is failing on PPC/OSX
> The real reason: darwin fucked uphow to call the 128bit long double math functions.
Could you elaborate, please?
What ever the answer will be, I think the design of the test case
large_real_kind_form_io_2.f90 is such that it can only work by chance.
The following code
character(80) :: string
real :: a, b
a = nearest(1.0,1.0)
print *, a
print '(f12.7)', a
write (string,*) a
read (string,*) b
if (a /= b) print *, 'case default: ', a-b
write (string,'(f20.7)') a
read (string,*) b
if (a /= b) print *, 'case f20.7: ', a-b
end
which is a real(4) reduced case of large_real_kind_form_io_2.f90,
prints
...
case default: 1.1920929E-07
when compiled with gfortran, ifort, and Portland Group fortran, just
because "print *, a" gives "1.000000" different from the value of a.
Compiled with xlf or g95 the code does print anything. So if
large_real_kind_form_io_2.f90 works on x86 platforms it is only because
the chosen values give strings which are then read to the same value.
The likelihood that it works with different precisions does not seem too
high for me (it fails with huge(0.0_k) and k=8).
Now trying to understand the problem I may have uncovered a probleme due
to the fact that "darwin fucked up".
Dominique