This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] Patch for test suite program: intrinsic_fraction_exponent.f90
- From: Feng Wang <fengwang at nudt dot edu dot cn>
- To: Paul Brook <paul at nowt dot org>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Tue, 4 Nov 2003 11:39:18 +0800 (HKT)
- Subject: Re: [gfortran] Patch for test suite program: intrinsic_fraction_exponent.f90
- Reply-to: Feng Wang <fengwang at nudt dot edu dot cn>
Quoting Paul Brook <paul@nowt.org>:
>
> ! y = (y / 2.) * (2._8 ** (z + 1))
> ! y = (y * 2.) * (2._8 ** (z + 1))
>
> Shouldn't these be y*2._8 and y/2._8 for consistency?
Yes, these should. I fixed.
>
> Other than that, ok.
>
> I suspect the old version didn't work because
reounding errors were
> different for the two methods. In other tests we
allow a small delt on the
> comarisons. Maybe we should also do this here.
In fact, the reason causing abort this time is the type
of exponent() which should be integer. The point you
mentioned is the potential error and I corrected.
What's more, I fixed another error in
intrinsic_scale.f90 where variable t should not be
used. All patches are attached.
Paul, please help me check.
2003-11-4 Feng Wang <fengwang@nudt.edu.cn>
* gfortran.fortran-
torture/excute/intrinsic_fraction_exponent.f90: Fix two
errors.
* gfortran.fortran-
torture/excute/intrinsic_scale.f90: Delete a variable.
diff -c3p /home/wf/gcc/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90 ./intrinsic_fraction_exponent.f90
*** /home/wf/gcc/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90 Wed Oct 22 18:54:32 2003
--- ./intrinsic_fraction_exponent.f90 Tue Nov 4 10:02:58 2003
*************** program test_exponent_fraction
*** 57,75 ****
end
subroutine test_4(x)
! real*4 x,y,z
y = fraction (x)
z = exponent(x)
! y = y * 2 * (2 ** (z - 1))
! if (x.ne.y) call abort()
end
subroutine test_8(x)
! real*8 x, y, z
!
y = fraction (x)
z = exponent(x)
! y = y * 2 * (2 ** (z-1))
! if (x.ne.y) call abort()
end
--- 57,84 ----
end
subroutine test_4(x)
! real*4 x,y
! integer z
y = fraction (x)
z = exponent(x)
! if (z .gt. 0) then
! y = (y * 2.) * (2. ** (z - 1))
! else
! y = (y / 2.) * (2. ** (z + 1))
! end if
! if (abs (x - y) .gt. abs(x * 1e-6)) call abort()
end
subroutine test_8(x)
! real*8 x, y
! integer z
y = fraction (x)
z = exponent(x)
! if (z .gt. 0) then
! y = (y * 2._8) * (2._8 ** (z - 1))
! else
! y = (y / 2._8) * (2._8 ** (z + 1))
! end if
! if (abs (x - y) .gt. abs(x * 1e-6)) call abort()
end
diff -c3p /home/wf/gcc/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_scale.f90 ./intrinsic_scale.f90
*** /home/wf/gcc/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_scale.f90 Wed Oct 22 18:54:33 2003
--- ./intrinsic_scale.f90 Tue Nov 4 10:03:11 2003
*************** subroutine test_real4 (x, i)
*** 15,22 ****
integer i
y = x * (2.0 ** i)
x = scale (x, i)
! if ((abs (x - y) .gt. abs(x * 1e-6)) &
! .and. (abs (x - t) .gt. abs(x * 1e-6)))call abort
end
subroutine test_real8 (x, i)
--- 15,21 ----
integer i
y = x * (2.0 ** i)
x = scale (x, i)
! if (abs (x - y) .gt. abs(x * 1e-6)) call abort
end
subroutine test_real8 (x, i)
*************** subroutine test_real8 (x, i)
*** 24,29 ****
integer i
y = x * (2.0 ** i)
x = scale (x, i)
! if ((abs (x - y) .gt. abs(x * 1e-6)) &
! .and. (abs (x - t) .gt. abs(x * 1e-6)))call abort
end
--- 23,27 ----
integer i
y = x * (2.0 ** i)
x = scale (x, i)
! if (abs (x - y) .gt. abs(x * 1e-6)) call abort
end