This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] patch for PR 15149 - problem computing PI
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Bud Davis <bdavis9659 at comcast dot net>, gcc-patches at gcc dot gnu dot org,Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Date: Sat, 1 May 2004 13:25:30 +0100
- Subject: Re: [gfortran] patch for PR 15149 - problem computing PI
- Organization: CodeSourcery
- References: <1083115289.7510.8.camel@localhost.localdomain> <200404281309.16002.paul@codesourcery.com> <1083202331.4806.12.camel@localhost.localdomain>
On Thursday 29 April 2004 02:32, Bud Davis wrote:
> On Wed, 2004-04-28 at 07:09, Paul Brook wrote:
> > The comment on the test says we're testing for !=0, so doing that
> > directly would speed up the test significantly.
>
> since the PR concerns the random number generator being broken, vs. it's
> quality, i propose this test:
>
> ! pr 15149
> ! verify the random number generator is functional
> IMPLICIT NONE
> INTEGER COUNT
> PARAMETER (COUNT=5)
> INTEGER I
> REAL R(COUNT),SUM
> DATA R / COUNT * 0.0 /
> CALL RANDOM_NUMBER(R)
> SUM = 0.0
> DO I=1,COUNT
> SUM = SUM + R(I)
> END DO
> IF (SUM.LE.0) CALL ABORT
> END
Possibly a better (simpler) way of writing this would be:
! pr 15149
! verify the random number generator is functional
program test_random
implicit none
real :: r(5) = 0.0
call random_number(r)
if (all (r .eq. 0)) call abort
end program
Please apply the patch and testcase.
Paul