This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Failure of test default_format_1.f90 on cygwin
- From: David Billinghurst <dbcygwin at gmail dot com>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 10 May 2009 14:35:35 +1000
- Subject: [PATCH] Failure of test default_format_1.f90 on cygwin
Test gfortran.dg/default_format_1.f90 fails on cygwin. The test checks
the default formats for formatted I/O of reals are wide enough and have
enough precision by writing and reading back floating point values.
On cygwin, the write/read is not exact in a couple of cases, but the
error is only in the last bit - a relative error of epsilon(x). While
not perfect, I think the tests still pass in spirit.
This patch introduces a small tolerance to the test. If this is not
acceptable then I will XFAIL the test.
2009-05-10 David Billinghurst <billingd@gcc.gnu.org>
* gfortran.dg/default_format_1.inc: Allow relatve error of
epsilon(x).
--- default_format_1.inc 2007-10-08 16:31:30.000000000 +1100
+++ default_format_1.inc 2009-05-10 14:20:19.562500000 +1000
@@ -23,7 +23,9 @@
do i = 0, count
write (s,*) x
read (s,*) y
- if (y /= x) res = res + 1
+ if (y /= x) then
+ if ( (x-y)/max(abs(x),abs(y)) >= 2*epsilon(x) ) res = res + 1
+ end if
x = nearest(x,huge(x))
end do
end if
@@ -33,7 +35,9 @@
do i = 0, count
write (s,*) x
read (s,*) y
- if (y /= x) res = res + 1
+ if (y /= x) then
+ if ( (x-y)/max(abs(x),abs(y)) >= 2*epsilon(x) ) res = res + 1
+ end if
x = nearest(x,-huge(x))
end do
end if
@@ -55,7 +59,9 @@
do i = 0, count
write (s,*) x
read (s,*) y
- if (y /= x) res = res + 1
+ if (y /= x) then
+ if ( (x-y)/max(abs(x),abs(y)) >= 2*epsilon(x) ) res = res + 1
+ end if
x = nearest(x,huge(x))
end do
end if
@@ -65,7 +71,9 @@
do i = 0, count
write (s,*) x
read (s,*) y
- if (y /= x) res = res + 1
+ if (y /= x) then
+ if ( (x-y)/max(abs(x),abs(y)) >= 2*epsilon(x) ) res = res + 1
+ end if
x = nearest(x,-huge(x))
end do
end if